diff --git a/src/xvaga/xvtmail.cpp b/src/xvaga/xvtmail.cpp index bc229a34c..63dbbf1c1 100755 --- a/src/xvaga/xvtmail.cpp +++ b/src/xvaga/xvtmail.cpp @@ -57,6 +57,11 @@ static bool has_power_mail() return GetMailParam("Powershell") == "X"; } +static bool has_ccnsend() +{ + return GetMailParam("CcnSend") == "X"; +} + short xvt_mail_installed() { short bInstalled = 0; @@ -339,7 +344,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn, */ wxStringTokenizer portTok(port, " "); wxString port_number; - bool ssl = false, hasccn = ccn && *ccn, hascc = cc && *cc; + bool ssl = false, hasccn = ccn && *ccn, hascc = cc && *cc; while(portTok.HasMoreTokens()) { @@ -373,6 +378,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn, file.Write("$To = "); file.Write(str_to); file.Write("\n"); file.Write("$Subject = \""); file.Write(subject); file.Write("\"\n"); file.Write("$Body = \""); file.Write(msg); file.Write("\"\n"); + if (hascc) { wxString str_cc(cc); @@ -380,13 +386,14 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn, buildPSArray(str_cc); file.Write("$CC = "); file.Write(str_cc); file.Write("\n"); } - if (hasccn) + + if (has_ccnsend()) { - wxString str_ccn(ccn); + wxString str_ccn(from); + buildPSArray(str_ccn); + file.Write("$Bcc = "); file.Write(str_ccn); file.Write("\n"); + } - buildPSArray(str_ccn); - file.Write("$Bcc = "); file.Write(str_ccn); file.Write("\n"); - } file.Write( "$message = new-object Net.Mail.MailMessage\n" "$message.From = $From\n" @@ -402,14 +409,15 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn, ); } - if (hasccn == true) + if (hasccn || has_ccnsend()) { file.Write( "foreach($i in $Bcc)\n" - "{ $message.Bcc.Add($i)}" + "{ $message.Bcc.Add($i)}\n" ); - } - + } + + file.Write( "$message.Subject = $Subject\n" "$message.Body = $Body\n"