Originally posted by: Robert Simpson
I've consolidated all the suggestions and fixed a couple of bugs in the class (namely the filename parameter close-quote bug for attachments). I'll have an update sent to Codeguru next week and will make the source available externally on my own website as well.
Ironically the close-quote for file attachments bug was discovered only through alt.comp.virus. Apparently the sobig virus uses my source code for its internal mailer and the intial incarnations of the virus had the close-quote bug from my source. Non-MS mail readers were failing to even show the attachment.
I also had to change the mime boundary tag in the source because thanks to Sobig, many people are blocking messages who's MIME boundary starts with "CSmtpMsgPart123X456".
Robert
Originally posted by: Antoine W. Campagna
This class is really great and works well. But the messages I received looked like they were sent from asia or something ( GMT of +0400, it should be -0400 from here). So I looked in the code and founf that when the GMTOffset is lower than 0, a minus sing is added two times (first by the "(GMTOffset>0)?'+':'-'" and second by the "%4.4d" which automatically adds it. I guess that there must be a way to format it using something else than %4.4d that would not add the minus sign but I don't know how. So I simply replaced the line :
wsprintf(szOut,_T("%s %s %c%4.4d"),szDate,szTime,(GMTOffset>0)?'+':'-',GMTOffset);
with the line
wsprintf(szOut,_T("%s %s %c%4.4d"),szDate,szTime,(GMTOffset>0)?'+':'-',(GMTOffset>0)?GMTOffset:0-GMTOffset);
so instead of writing
Date: Tue, 26 Aug 2003 14:29:55 --0400
to the server, it writes
Date: Tue, 26 Aug 2003 14:29:55 -0400
to the server.
I know it's not a big deal, but I just thougth it'd be useful pointing it out. Thank you for such a useful class.
Antoine W. Campagna aka AntAgna
CDE Syst-M Inc.
Originally posted by: babu
can someone help me as to how do we send mails using this smtp class using RTF format.
thanks
ReplyOriginally posted by: Steve Eilersen
Does anyone have SMTP example for a consol app ???
ReplyOriginally posted by: Stehan Eckbauer
good class, thank you.
There is a small bug in GuessEncoding:
Add to CSmtpMessage::GuessEncoding:
// Determine if it is mostly 7bit data
I would suggest that someone updates the source code with all the suggestions made here.
Hi,
If the data to be encoded contains only a single line and that line is more than 76 characters long, the functions telles the wrong encoding. Here is my suggested fix:
Find the following line:
// Determine if it is mostly 7bit data
Insert the code just before the line.
//insert from here
if (nLines == 0)
{
//if there is only one line then check if the line is longer than 76 chars
if (dwLen > 76) nLinesOver76 ++;
}
//insert up to here
if ((n7Bit * 100) / dwLen > 89)
Best regards, Stephan Eckbauer
Originally posted by: khalid belasri
Hi,
I have tested this class and it works very well,but I don't know how to use it to send mail using hotmail server(with authentification).Please,if you have any idea,send me a message to my email address : khalid_belasri@hotmail.com.
Many thanks in advance.
Originally posted by: Gerhard Junker
This handling is missed in the classes.
In the Smtp::Sendcmd you have to change
search for this line:
// insert this
using this class is very easy. I crashed with a special smtp server, who sends more than one message back. In rfc822 a continuation line is signaled with a hyphen after the numeric response.
ex: 250-OK
// Add the data to the total response string & check for a LF
pszPos += nRet;
pszTok = strrchr(szResult,'\n');
if (pszTok)
{
// Truncate CRLF combination and exit our wait loop
pszTok --;
pszTok[0] = 0;
pszTok = strrchr(szResult,'\n');
if (!pszTok) pszTok = szResult;
else pszTok++;
if (pszTok[3] == '-') continue;
break;
// until here
}
Originally posted by: Mario
Yahoo recived the attach with name UNKNOWN_PARAMETER_VALUE
Can you help me ?
Originally posted by: Kirill A. Bykov
Works fine, at least those features i need.
The only change i had to make was the type of the 1st argument of BOOL CSmtp::Connect. LPCTSTR pszServer looks much better :-)
Originally posted by: Eckhard Schwabe
EncodingEnum CSmtpMessage::GuessEncoding(LPBYTE pByte, DWORD dwLen)
to handle this situation, just add:
void CSmtpMessage::EncodeMessage(EncodingEnum code, String& strMsg, String& strMethod, LPBYTE pByte, DWORD dwSize)
....
If the file which should be attached is empty
there will be a "division by zero" error in the "GuessEncoding" function:
{
...
if ((n7Bit * 100) / dwLen > 89) // division by zero possible
...
}
{
if (dwSize == 0
{
TCHAR szOut[MAX_PATH];
wsprintf(szOut,_T("Warning: Empty Attachment File\n\n"));
OutputDebugString(szOut);
return;
}