Patch level : 12.0 640

Files correlati     :
Commento            : Aggiunto parametro per non mettersi in copia conoscenza nascosta durante l'invio di una powermail
This commit is contained in:
Mattia Tollari 2018-10-30 12:54:28 +01:00
parent 06012aa2a9
commit ad4ecab120

View File

@ -307,15 +307,38 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
// Creo il file
wxFile file(powerFile, wxFile::write);
// Parsing port tokens
/* Token dictionary (all case insensitive):
* 465/587/... port
* -SSL Enable ssl/tls
* -nbcc No Blind Carbon Copy
*/
wxStringTokenizer portTok(port, " ");
wxString port_number;
bool ssl = false, bcc = true;
while(portTok.HasMoreTokens())
{
wxString tok = portTok.GetNextToken();
if (tok[0] >= '0' && tok[0] <= '9')
port_number = tok;
if (tok.Upper() == "-SSL")
ssl = true;
if (tok.Upper() == "-NBCC")
bcc = false;
}
// Hard code and no play makes Tolla a dull programmer
file.Write("$Server = \""); file.Write(server); file.Write("\";\n");
wxStringTokenizer portTok(port, " ");
file.Write("$Port = \""); file.Write(portTok.GetNextToken()); file.Write("\";\n");
file.Write("$Port = \""); file.Write(port_number); file.Write("\";\n");
file.Write("$SSL = ");
if(portTok.GetNextToken().Upper() == "-SSL")
if(ssl)
file.Write("$true");
else
file.Write("$false");
file.Write("\n");
file.Write("$Username = \""); file.Write(user); file.Write("\";\n");
file.Write("$Password = \""); file.Write(password); file.Write("\";\n");
@ -324,13 +347,15 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
file.Write("$Subject = \""); file.Write(subject); file.Write("\";\n");
file.Write("$Body = \""); file.Write(msg); file.Write("\";\n");
file.Write(
"$message = new-object Net.Mail.MailMessage;\n"
"$message.From = $From\n"
"$message.To.Add($To);\n"
#ifndef DBG
"$message.Bcc.Add($From);\n"
#endif
"$message.Subject = $Subject;\n"
"$message = new-object Net.Mail.MailMessage;\n"
"$message.From = $From\n"
"$message.To.Add($To);\n");
if (bcc)
file.Write("$message.Bcc.Add($From);\n");
file.Write(
"$message.Subject = $Subject;\n"
"$message.Body = $Body;\n"
);
@ -372,6 +397,5 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
wxString command;
command << "PowerShell -NonInteractive -NoProfile -Command \"& {"<< powerFile <<"; exit $LastExitCode }\"";
int exitCode = system(command);
return exitCode;
return system(command);;
}