Patch level : 12.0 nopatch
Files correlati : Commento : Modifiche invio mail tramite campo
This commit is contained in:
parent
396421fea4
commit
cf6620a446
@ -437,65 +437,28 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
||||
"$smtp = new-object Net.Mail.SmtpClient($Server, $Port);\n"
|
||||
"$smtp.EnableSSL = $SSL;\n"
|
||||
"$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);\n"
|
||||
"$exitCode = 1\n"
|
||||
"try\n"
|
||||
"{\n"
|
||||
" $smtp.send($message);\n"
|
||||
" write-host \"E-Mail sent\" \n"
|
||||
" $exitCode = 1 \n"
|
||||
" Out-File -FilePath \"C:\\Users\\smen\\Desktop\\Pmail\\ExitCode.txt\" -InputObject $exitCode \n"
|
||||
" exit $exitCode \n"
|
||||
"}\n"
|
||||
"catch\n"
|
||||
"{\n"
|
||||
" write-host \"E-Mail not sent\" ; \n"
|
||||
" $exitCode = 0 \n"
|
||||
" Out-File -FilePath \".\ExitCode.txt\" -InputObject $exitCode \n"
|
||||
" exit $exitCode \n"
|
||||
"}\n"
|
||||
);
|
||||
file.Close();
|
||||
|
||||
wxString command("powershell.exe -File ");
|
||||
// command << R"(PowerShell -ExecutionPolicy ByPass -NonInteractive -NoProfile -Command "{)" << powerFile << R"(; exit $LastExitCode }")";
|
||||
|
||||
//una volta scritto lo scritp ps1 cos'è che lo runna? Dove vinene aperta la PowerShell?
|
||||
// al momento lo script generato da campo funziona se runnato direttamente da powershell
|
||||
command << powerFile;
|
||||
int exit = xvt_sys_execute(command, true, true);
|
||||
|
||||
//nt exit = system( + powerFile);
|
||||
|
||||
//wxString exitFile;
|
||||
//wxString exitFileName = "ExitCode.txt";
|
||||
//xvt_fsys_build_pathname(exitFile.GetWriteBuf(_MAX_PATH), NULL, userTemp, exitFileName, NULL , NULL);
|
||||
//exitFile.UngetWriteBuf();
|
||||
|
||||
// Creo il file di log
|
||||
//wxTextFile logFile;
|
||||
//logFile.Open(exitFile);
|
||||
//wxString logStr = logFile.GetFirstLine();
|
||||
//int exitCode;
|
||||
//exitCode = wxAtoi(logStr);
|
||||
|
||||
//system("powershell.exe $lastexitcode");
|
||||
|
||||
/*
|
||||
BOOLEAN sys_command = (BOOLEAN)system(command);
|
||||
if (!sys_command)
|
||||
{
|
||||
std::ofstream fout;
|
||||
wxString error_file;
|
||||
error_file << userTemp << "\\" << "error_mail.txt";
|
||||
fout.open(error_file, std::ios_base::out);
|
||||
if (fout.is_open())
|
||||
{
|
||||
fout << command << "\n";
|
||||
fout.close();
|
||||
}
|
||||
}
|
||||
*/
|
||||
//sys.command;
|
||||
return exit
|
||||
;
|
||||
return exit;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user