fixed bug in generation of the To: header: trailing comma prevented the messages from being ever sent out
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35426 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -61,29 +61,31 @@ bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wx
|
|||||||
return session.Send(message);
|
return session.Send(message);
|
||||||
}
|
}
|
||||||
#elif defined(__UNIX__)
|
#elif defined(__UNIX__)
|
||||||
bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& sendMail)
|
bool
|
||||||
|
wxEmail::Send(wxMailMessage& message,
|
||||||
|
const wxString& profileName,
|
||||||
|
const wxString& sendMail)
|
||||||
{
|
{
|
||||||
wxASSERT (message.m_to.GetCount() > 0) ;
|
wxASSERT_MSG( !message.m_to.IsEmpty(), _T("no recipients to send mail to") ) ;
|
||||||
|
|
||||||
|
|
||||||
// The 'from' field is optionally supplied by the app; it's not needed
|
// The 'from' field is optionally supplied by the app; it's not needed
|
||||||
// by MAPI, and on Unix, will be guessed if not supplied.
|
// by MAPI, and on Unix, will be guessed if not supplied.
|
||||||
wxString from = message.m_from;
|
wxString from = message.m_from;
|
||||||
if (from.IsEmpty())
|
if ( from.empty() )
|
||||||
{
|
{
|
||||||
from = wxGetEmailAddress();
|
from = wxGetEmailAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT (!from.IsEmpty());
|
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg << wxT("To: ");
|
msg << wxT("To: ");
|
||||||
|
|
||||||
size_t i;
|
const size_t rcptCount = message.m_to.GetCount();
|
||||||
for (i = 0; i < message.m_to.GetCount(); i++)
|
for (size_t rcpt = 0; rcpt < rcptCount; rcpt++)
|
||||||
{
|
{
|
||||||
msg << message.m_to[i];
|
if ( rcpt )
|
||||||
if (i < message.m_to.GetCount())
|
|
||||||
msg << wxT(", ");
|
msg << wxT(", ");
|
||||||
|
msg << message.m_to[rcpt];
|
||||||
}
|
}
|
||||||
|
|
||||||
msg << wxT("\nFrom: ") << from << wxT("\nSubject: ") << message.m_subject;
|
msg << wxT("\nFrom: ") << from << wxT("\nSubject: ") << message.m_subject;
|
||||||
|
Reference in New Issue
Block a user