Update of /cvsroot/mahogany/M/src/mail
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24851/src/mail
Modified Files:
SendMessageCC.cpp
Log Message:
report errors if sending mail via MTA fails
Index: SendMessageCC.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/mail/SendMessageCC.cpp,v
retrieving revision 1.233
retrieving revision 1.234
diff -b -u -2 -r1.233 -r1.234
--- SendMessageCC.cpp 23 Jun 2006 23:27:31 -0000 1.233
+++ SendMessageCC.cpp 31 Aug 2006 23:45:33 -0000 1.234
@@ -44,4 +44,8 @@
#include "MFolder.h"
+#ifdef OS_UNIX
+# include "sysutil.h"
+#endif // OS_UNIX
+
// has to be included before SendMessage.h, as it includes windows.h which
// defines SendMessage under Windows
@@ -1921,6 +1925,6 @@
// write to temp file:
wxFile out;
- const String filename = wxFileName::CreateTempFileName(
- _T("Mtemp"), &out);
+ MTempFileName tmpFN(&out);
+ const String& filename = tmpFN.GetName();
bool success = false;
@@ -1931,16 +1935,19 @@
if ( written == lfOnly.Length() )
{
- String command;
- command.Printf(_T("%s < '%s'; exec /bin/rm -f '%s'"),
- m_SendmailCmd.c_str(),
- filename.c_str(), filename.c_str());
- // HORRIBLE HACK: this should be `const char *' but
wxExecute's
- // prototype doesn't allow it...
- wxChar *argv[4];
- argv[0] = (wxChar *)"/bin/sh";
- argv[1] = (wxChar *)"-c";
- argv[2] = (wxChar *)command.c_str();
- argv[3] = 0; // NULL
- success = wxExecute(argv) != 0;
+ int rc = system(m_SendmailCmd + " < " + filename);
+ if ( WEXITSTATUS(rc) != 0 )
+ {
+ ERRORMESSAGE((_("Failed to execute local MTA \"%s\""),
+ m_SendmailCmd.c_str()));
+ }
+ else
+ {
+ success = true;
+ }
+ }
+ else
+ {
+ ERRORMESSAGE((_("Failed to write to temporary file \"%s\""),
+ filename.c_str()));
}
}
@@ -1962,6 +1969,9 @@
else
{
- ERRORMESSAGE((_("Failed to send message via '%s'"),
- m_SendmailCmd.c_str()));
+ ERRORMESSAGE((_("Failed to send message via local MTA, maybe "
+ "it's not configured correctly?\n"
+ "\n"
+ "Please try using an SMTP server if you are not
"
+ " sure.")));
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates