Patch level : 12.00 1368
Files correlati : xvaga.dll xwsmtp.dll ba0100m.msk sc0.exe sc2100b.msk sc2400b.msk Commento: Invio estratti conti e solleciti via mail
This commit is contained in:
parent
d63fe98078
commit
aa2296775c
@ -583,11 +583,14 @@ XVTDLL BOOLEAN xvt_url_get(const char * url, const char * path, const
|
|||||||
XVTDLL void xvt_set_mail_params(const char * smtp, const char * port, const char * user, const char * pass, const char * from);
|
XVTDLL void xvt_set_mail_params(const char * smtp, const char * port, const char * user, const char * pass, const char * from);
|
||||||
// Send email using normal methods
|
// Send email using normal methods
|
||||||
|
|
||||||
XVTDLL BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
|
// flags 0x1=UI; 0x2=Receipt
|
||||||
const char* subject, const char* msg, const char* attach, short flags); // 0x1=UI; 0x2=Receipt
|
XVTDLL BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn, const char* subject,
|
||||||
|
const char* msg, const char* attach, short flags);
|
||||||
// Send email using Microsoft Powershell
|
// Send email using Microsoft Powershell
|
||||||
XVTDLL BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
XVTDLL BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
||||||
const char* subject, const char* msg, const char* attach, short flags, const char* usr); // 0x1=UI; 0x2=Receipt
|
const char* subject, const char* msg, const char* attach, short flags, const char* usr); // 0x1=UI; 0x2=Receipt
|
||||||
|
XVTDLL BOOLEAN xvt_wx_mail_send(const char* to, const char* cc, const char* ccn, const char* subject,
|
||||||
|
const char* msg, const char* attach, short flags);
|
||||||
XVTDLL short xvt_mail_installed();
|
XVTDLL short xvt_mail_installed();
|
||||||
|
|
||||||
XVTDLL void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down);
|
XVTDLL void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down);
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/mimetype.h>
|
#include <wx/mimetype.h>
|
||||||
#include <wx/textfile.h>
|
#include <wx/textfile.h>
|
||||||
|
#include <email.h>
|
||||||
|
#include <smtp.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
static wxString GetMailParam(const char* key, const char* def = "")
|
static wxString GetMailParam(const char* key, const char* def = "")
|
||||||
@ -69,7 +71,7 @@ void xvt_set_mail_params(const char * smtp, const char * port, const char * user
|
|||||||
if (user && *user)
|
if (user && *user)
|
||||||
__user = _strdup(user);
|
__user = _strdup(user);
|
||||||
if (pass && *pass)
|
if (pass && *pass)
|
||||||
__pass = _strdup(from);
|
__pass = _strdup(pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetMailParams(wxString& smtp, wxString& port, wxString& user, wxString& pass, wxString& from)
|
static bool GetMailParams(wxString& smtp, wxString& port, wxString& user, wxString& pass, wxString& from)
|
||||||
@ -503,7 +505,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
file.Write("$CC = "); file.Write(str_cc); file.Write("\n");
|
file.Write("$CC = "); file.Write(str_cc); file.Write("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_ccnsend())
|
if (hasccn || has_ccnsend())
|
||||||
{
|
{
|
||||||
wxString str_ccn(from);
|
wxString str_ccn(from);
|
||||||
buildPSArray(str_ccn);
|
buildPSArray(str_ccn);
|
||||||
@ -517,7 +519,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
|
|
||||||
//TODO same per from e to
|
//TODO same per from e to
|
||||||
//mettere un flag nella mask per decidere se mettere in CC o in CCn
|
//mettere un flag nella mask per decidere se mettere in CC o in CCn
|
||||||
if (hascc == true)
|
/*if (hascc == true)
|
||||||
{
|
{
|
||||||
file.Write(
|
file.Write(
|
||||||
"foreach($i in $CC)\n"
|
"foreach($i in $CC)\n"
|
||||||
@ -531,7 +533,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
"foreach($i in $Bcc)\n"
|
"foreach($i in $Bcc)\n"
|
||||||
"{ $message.Bcc.Add($i)}\n"
|
"{ $message.Bcc.Add($i)}\n"
|
||||||
);
|
);
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
file.Write(
|
file.Write(
|
||||||
@ -571,6 +573,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
"catch\n"
|
"catch\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" write-host \"E-Mail not sent\" ; \n"
|
" write-host \"E-Mail not sent\" ; \n"
|
||||||
|
" write-host $_.Exception.Message ;\n"
|
||||||
" $exitCode = 1 \n"
|
" $exitCode = 1 \n"
|
||||||
" exit $exitCode \n"
|
" exit $exitCode \n"
|
||||||
"}\n"
|
"}\n"
|
||||||
@ -582,7 +585,9 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
//una volta scritto lo scritp ps1 cos'è che lo runna? Dove vinene aperta la PowerShell?
|
//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
|
// al momento lo script generato da campo funziona se runnato direttamente da powershell
|
||||||
command << powerFile;
|
command << powerFile;
|
||||||
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
fopen_s(&f, "maillog.log", "w");
|
fopen_s(&f, "maillog.log", "w");
|
||||||
fprintf(f, "Comando %s\n", (const char*)command);
|
fprintf(f, "Comando %s\n", (const char*)command);
|
||||||
int exit = xvt_sys_execute(command, true, true);
|
int exit = xvt_sys_execute(command, true, true);
|
||||||
@ -590,3 +595,60 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
return exit == 0;
|
return exit == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_wx_mail_send(const char* to, const char* cc, const char* ccn,
|
||||||
|
const char* subject, const char* msg,
|
||||||
|
const char* attach, short flags)
|
||||||
|
{
|
||||||
|
wxString server, port, user, password, from;
|
||||||
|
GetMailParams(server, port, user, password, from);
|
||||||
|
bool ui = (flags & 0x1) != 0;
|
||||||
|
wxSMTP * Smtp = new wxSMTP(nullptr);
|
||||||
|
wxString str_to(to);
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
if (ui)
|
||||||
|
{
|
||||||
|
wxEmailDlg dlg;
|
||||||
|
|
||||||
|
dlg._strEmail = str_to;
|
||||||
|
if (dlg.ShowModal() == wxID_OK)
|
||||||
|
str_to = dlg._strEmail;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxStringTokenizer tokTo(str_to, _T(";"));
|
||||||
|
wxEmailMessage * Msg = new wxEmailMessage(subject, msg, from);
|
||||||
|
|
||||||
|
// da trovare Msg->m_query_receipt = flags & 0x2;
|
||||||
|
while (tokTo.HasMoreTokens())
|
||||||
|
Msg->AddTo(tokTo.GetNextToken());
|
||||||
|
if (attach && *attach)
|
||||||
|
{
|
||||||
|
wxStringTokenizer tokAttach(attach, _T(";"));
|
||||||
|
while (tokAttach.HasMoreTokens())
|
||||||
|
Msg->AddFile(tokAttach.GetNextToken());
|
||||||
|
}
|
||||||
|
if (cc && *cc)
|
||||||
|
{
|
||||||
|
wxStringTokenizer Tok(cc, _T(";"));
|
||||||
|
while (Tok.HasMoreTokens())
|
||||||
|
Msg->AddCc(Tok.GetNextToken());
|
||||||
|
}
|
||||||
|
if (ccn && *ccn)
|
||||||
|
{
|
||||||
|
wxStringTokenizer Tok(ccn, _T(";"));
|
||||||
|
while (Tok.HasMoreTokens())
|
||||||
|
Msg->AddBcc(Tok.GetNextToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
int service = atoi(port);
|
||||||
|
|
||||||
|
if (service == 0)
|
||||||
|
service = 25;
|
||||||
|
Smtp->SetHost(server, service, from, password);
|
||||||
|
Smtp->Send(Msg);
|
||||||
|
Smtp->SendData();
|
||||||
|
delete Msg;
|
||||||
|
delete Smtp;
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user