WxSMTP
From WxWiki
[edit] wxSMTP
Broken links fixed Again Please report broken download-links to Tavasti
Original version by Frank Buß
Newer modified version 1.11, modified 2004-06-29 by Markku Tavasti
Contributed version, not tested by tavasti by G. Paul Ziemba <paul at w6yx.stanford.edu>. Contains error handling. Most likely this is best version.
This code needs active maintainer. If you are intrested, contact Tavasti
Excerpt from a message Tavasti sent to wx-users -
Things I have done:
- Made wxSMTP & co separate library (Makefile 'works for me',
supporting building for linux & windows under linux cross compilation)
- Added writing To, Cc: etc headers
- Possibility to add alternative parts (text and html in same E-mail)
All is distributed under wxWidgets license (I have permission from
Frank Buß). All fixes and enchantments welcome directly to me.
Code is kind of orphaned. Frank does not have time to continue
development, and neither do I. So we both would be happy if somebody
would take code, and start acting as maintainer for it. And it would
be nice if it would be included to wxwindows contrib.
Here is example code of usage (hopefully no typos, did not test this snippet)
wxSMTP *smtp = new wxSMTP(NULL);
smtp->SetHost("smtpserver.domain.com");
wxEmailMessage *msg = new wxEmailMessage("Bug report",
"Your code really sucks.\n"
"Fix your code",
"tavasti@iki.fi");
msg->AddAlternative("<html><body><h1>Bug report</h1>\n"
"Your code <b>really</b> sucks <p>Fix your code</html>",
"text","html");
msg->AddTo("tavasti@iki.fi");
smtp->Send(msg);
Additional Notes from John Edwards : jedwards AT motorola.com
I have been using version 1.9 of wxSMTP under Windows and Linux successfully.
One thing I did notice is that wxSMTP uses the wxSocket interface and this will clash with the standard UNIX socket interface if they are used together in the same application. For my app I was using the standard socket interface for real time streaming i/o and wxSMTP for emailing out the streams which had been stored in files. I found I had to close all of the standard sockets before using wxSMTP otherwise wxSMTP did not send the emails.
When building apps under Windows I use the free Borland toolset. I am not familiar enough with makefiles to be able to modify the supplied makefile to work with the Borland toolset so I have written a batch file that builds the library. The contents are :
<<start>>
@echo off
rem batch file for creating wxSMTP library
bcc32 @c:\wxWindows-2.4.2\src\msw\wxw32.cfg -v -Od -c "-I..\include" *.cpp
tlib wxsmtp.lib -+wxmime.obj tlib wxsmtp.lib -+wxcmdprot.obj tlib wxsmtp.lib -+wxemail.obj tlib wxsmtp.lib -+wxbase64.obj tlib wxsmtp.lib -+wxsmtp.obj tlib wxsmtp.lib -+wxstates.obj
<<end>>
- - - - - - - - - - - - - - - - - - - - - - -
QUESTION (from Marc at bowery dot com): How does this differ from wxEmail (contrib/src/net and contrib/include/wx/net) ?
Answer (Helmut Gruber): wxEmail uses MAPI on Windows, and sendmail/postfix on Unix
- - - - - - - - - - - - - - - - - - - - - - -
QUESTION (from Olaf): why is wxSMTP derived from the custom class wxCmdLineProtocol and not from the wxProtocol class?
Answer (Tavasti): That's the way Frank Buß did it. SMTP is CmdLine-type protocol, so there might be good idea on it? Answer (Frank Buß): My idea was to derive other protocols as well, e.g. FTP, which are command line based, too. I don't know, if this works, maybe delegation and some smaller utility classes are more useful.
QUESTION (from Tom): I tried to get wxSMTP to send an email. I received no errors, or anything else, but I also didn't receive an email. I downloaded and tried to build Wino, to see what I was doing wrong. Shortly afterward I started getting this error every time I tried to build anything:
..\..\include\wx\chkconf.h(76) : fatal error C1189: #error : "wxUSE_CRASHREPORT must be defined."
I tried rebuilding wxWidgets, but got the same error. So, I replaced the setup.h file with the setup0.h file, and still got the same error. After looking to see what files had been modified, I found that my platform.h file had this line commented out:
include "wx/setup.h"
I can't be sure that the fault lies with Wino or wxSMTP, but it's very strange.
