Patch level : 12.00 1310
Files correlati : xvaga.dll Commento : 349170 : L'invio per posta dalle stampe non chiedeva più il destinatario
This commit is contained in:
parent
78a546519f
commit
b1e17b3e5b
@ -73,6 +73,7 @@ short xvt_mail_installed()
|
||||
if (xvt_fsys_file_exists("servers/mailsend.exe") || has_power_mail())
|
||||
{
|
||||
wxString smtp, port, user, pass, from;
|
||||
|
||||
GetMailParams(smtp, port, user, pass, from);
|
||||
if (!pass.IsEmpty() && smtp != "MAPI")
|
||||
bInstalled |= 0x2;
|
||||
@ -115,17 +116,73 @@ static void AppendAttachment(wxString& cmd, const wxString& fname, bool att = tr
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// wxEmailDlg
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class wxEmailDlg : public wxDialog
|
||||
{
|
||||
protected:
|
||||
wxTextCtrl* AddString(wxSizer* ctlSizer, int id, const char* label, wxString* str);
|
||||
|
||||
public:
|
||||
wxString _strEmail;
|
||||
wxEmailDlg();
|
||||
};
|
||||
|
||||
wxTextCtrl* wxEmailDlg::AddString(wxSizer* ctlSizer, int id, const char* label, wxString* str)
|
||||
{
|
||||
wxStaticText* lbl = new wxStaticText(this, wxID_ANY, label);
|
||||
|
||||
const int k = 20, b = k / 10;
|
||||
wxTextCtrl* txt = new wxTextCtrl(this, id, wxEmptyString, wxDefaultPosition, wxSize(20 * k, k),
|
||||
0, wxTextValidator(wxFILTER_ASCII, str));
|
||||
ctlSizer->Add(lbl, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, b);
|
||||
ctlSizer->Add(txt, 1, wxALIGN_LEFT | wxALL, b);
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
wxEmailDlg::wxEmailDlg() : wxDialog(NULL, wxID_ANY, "Email",
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE)
|
||||
{
|
||||
wxSizer* ctlTextSizer = new wxFlexGridSizer(4, 2, 8, 8);
|
||||
|
||||
AddString(ctlTextSizer, 1001, "Destinatario", &_strEmail);
|
||||
|
||||
wxSizer* ctlButtonSizer = CreateButtonSizer(wxOK | wxCANCEL);
|
||||
wxBoxSizer* ctlTopSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
ctlTopSizer->Add(ctlTextSizer, 0, wxALIGN_CENTER);
|
||||
ctlTopSizer->Add(ctlButtonSizer, 0, wxALIGN_CENTER);
|
||||
SetSizer(ctlTopSizer);
|
||||
ctlTopSizer->SetSizeHints(this);
|
||||
}
|
||||
|
||||
BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
|
||||
const char* subject, const char* msg,
|
||||
const char* attach, short flags)
|
||||
{
|
||||
bool ui = (flags & 0x1) != 0;
|
||||
const short mail_inst = xvt_mail_installed();
|
||||
wxString server, port, user, password, from;
|
||||
bool mailsend = (mail_inst & 0x2) && GetMailParams(server, port, user, password, from);
|
||||
bool ui = mailsend && ((flags & 0x1) != 0);
|
||||
wxString str_to(to);
|
||||
|
||||
wxStringTokenizer tokTo(to, _T(";"));
|
||||
if (ui)
|
||||
{
|
||||
wxEmailDlg dlg;
|
||||
|
||||
dlg._strEmail = str_to;
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
str_to = dlg._strEmail;
|
||||
}
|
||||
|
||||
wxStringTokenizer tokTo(str_to, _T(";"));
|
||||
wxMailMessage Msg(subject, tokTo.GetNextToken(), msg);
|
||||
|
||||
Msg.m_query_receipt = flags & 0x2;
|
||||
Msg.m_query_receipt = flags & 0x2;
|
||||
|
||||
while (tokTo.HasMoreTokens())
|
||||
Msg.AddTo(tokTo.GetNextToken());
|
||||
@ -156,12 +213,9 @@ BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
|
||||
Msg.AddBcc(Tok.GetNextToken());
|
||||
}
|
||||
|
||||
const short mail_inst = xvt_mail_installed();
|
||||
|
||||
BOOLEAN ok = FALSE;
|
||||
|
||||
wxString server, port, user, password, from;
|
||||
if ((mail_inst & 0x2) && GetMailParams(server, port, user, password, from))
|
||||
if (mailsend)
|
||||
{
|
||||
wxString cmd = "servers/mailsend.exe";
|
||||
AppendQuotedString(cmd, "smtp", server);
|
||||
@ -280,7 +334,8 @@ BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
|
||||
delete [] buff;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
if (mail_inst & 1)
|
||||
{
|
||||
xvt_fsys_save_dir();
|
||||
@ -319,11 +374,24 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
||||
const char* attach, short flags, const char* usr)
|
||||
{
|
||||
wxString server, port, user, password, from;
|
||||
|
||||
// Controllo che Windows sia almeno 8 e che riesca a ricevere i parametri E-mail
|
||||
if(xvt_sys_get_os_version() < XVT_WS_WIN_7 || !GetMailParams(server, port, user, password, from))
|
||||
xvt_mail_send(to, cc, ccn, subject, msg, attach, flags);
|
||||
|
||||
wxString str_to(to);
|
||||
|
||||
if ((flags & 0x1) != 0)
|
||||
{
|
||||
wxEmailDlg dlg;
|
||||
|
||||
dlg._strEmail = str_to;
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
str_to = dlg._strEmail;
|
||||
}
|
||||
|
||||
DIRECTORY tmp; xvt_fsys_get_temp_dir(&tmp);
|
||||
|
||||
// Per togliere il rischio di sovrapposizioni vado nella cartella dell'utente
|
||||
wxString userTemp; userTemp << tmp.path << "\\" << usr;
|
||||
|
||||
@ -372,7 +440,7 @@ BOOLEAN xvt_powermail_send(const char* to, const char* cc, const char* ccn,
|
||||
file.Write("$Username = \""); file.Write(user); file.Write("\"\n");
|
||||
file.Write("$Password = \""); file.Write(password); file.Write("\"\n");
|
||||
file.Write("$From = \""); file.Write(from); file.Write("\"\n");
|
||||
wxString str_to(to);
|
||||
|
||||
|
||||
buildPSArray(str_to);
|
||||
file.Write("$To = "); file.Write(str_to); file.Write("\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user