Testsmtp.prg FWH9.03
Testsmtp.prg FWH9.03
Hello all,
the test run fine, and I receive the mail, but the PRG attachment is displayed inline (it's not attached to the message)
Is the class included in FWH9.03 the most recent one ? (I've read in the forum that there might have been some improvements recently )
Thank you,
Davide
the test run fine, and I receive the mail, but the PRG attachment is displayed inline (it's not attached to the message)
Is the class included in FWH9.03 the most recent one ? (I've read in the forum that there might have been some improvements recently )
Thank you,
Davide
Re: Testsmtp.prg FWH9.03
Looks like changing "application/x-unknown-content-type" with "application/octet-stream" in line 632 cures the problem (at least in Thunderbird)
Still would like to know if there's an updated Tsmtp class somewhere before making other changes.
Thanks,
Davide
Still would like to know if there's an updated Tsmtp class somewhere before making other changes.
Thanks,
Davide
Re: Testsmtp.prg FWH9.03
I made another modification to method OnRead() - Lines 341-345 - so that the attachments are displayed with the proper case and the path is not shown in the mail (some clients did show it cause the full "name=")
Hi,
Davide
xH 1.2.1 - FWH 9.04
Code: Select all
oSocket:SendData( CRLF + "--NextPart" + CRLF + ;
"Content-Type: " + DocType( cExt ) + ;
'name="' + CaseFileName( ::aFiles[ nI ] ) + '"' + CRLF + ; // *GD* ::aFiles[ nI ] + '"' + CRLF + ;
"Content-Transfer-Encoding: base64" + CRLF + ;
"Content-Disposition: attachment; " + ; // LKM was inline
'filename="' + CaseFileName( ::aFiles[ nI ] ) + '"' + CRLF + CRLF )
// *GD* 'filename="' + cFileNoPath( ::aFiles[ nI ] ) + '"' + CRLF + CRLF )
--- At the end of the prg ---
***********************************
Static Function CaseFileName(cFile)
***********************************
Return SubStr(cFile,RAT("\",cFile)+1)
Davide
xH 1.2.1 - FWH 9.04
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Testsmtp.prg FWH9.03
Davide,
Thanks for the info!
Yes, 9.03 uses the most recent one, as far as we know it.
Thanks for the info!
Yes, 9.03 uses the most recent one, as far as we know it.
Re: Testsmtp.prg FWH9.03
Antonio,
Thank you,
Davide
ok, I'll continue posting the modifications here, should I find other improvements.Antonio Linares wrote:Thanks for the info!
Yes, 9.03 uses the most recent one, as far as we know it.
Thank you,
Davide
Re: Testsmtp.prg FWH9.04
I've changed the DocType function as follows, because the previous method didn't work correctly for some extensions.ok, I'll continue posting the modifications here, should I find other improvements.
HTH
Davide
Code: Select all
Static Function DocType( cExt )
Local cType
Do Case
Case Ascan( {"EXE","COM","OBJ","LIB","DLL","VBX","OCX","HLP","CHM"},cExt ) > 0
cType := "application/octet-stream; "
Case Ascan( {"ZIP","ARC","ZOO","TAR"},cExt ) > 0
cType := "application/x-zip-compressed; "
Case Ascan( {"HTM","HTML","SHT","SHTML","MHT","MHTML"},cExt ) > 0
cType := "text/html; "
Case cExt == "CSS"
cType := "text/css; "
Case Ascan( {"XML","XSL"},cExt ) > 0
cType := "text/xml; "
Case Ascan( {"TXT","TEXT","LOG","BAT"},cExt ) > 0
cType := "text/plain; "
Case cExt == "PDF"
cType := "application/pdf; "
Case Ascan( {"BMP","DIB"},cExt ) > 0
cType := "application/bmp; "
Case cExt == "GIF"
cType := "image/gif; "
Case Ascan( {"JPG","JPE","JPEG","JFI","JFIF","PJP"},cExt ) > 0
cType := "image/jpeg; "
Case Ascan( {"XLS","XLT","XLA","XLB","XLC","XLL","XLM","XLW"},cExt ) > 0
cType := "application/x-msexcel; "
Case Ascan( {"PPT","PPS","POT","PWZ"},cExt ) > 0
cType := "application/x-mspowerpoint; "
Case Ascan( {"MPG","MPE","MPEG","M1S","M1A","MP2","MPM","MPA"},cExt ) > 0
cType := "video/mpeg; "
Case Ascan( {"PIC","PICT","PCT"},cExt ) > 0
cType := "image/pict; "
Case cExt == "PNG"
cType := "image/png; "
Case Ascan( {"MOV","QT","QTL","QTS","QTX","QTIF","QDA","QDAT","QPX","QTP"},cExt ) > 0
cType := "video/quicktime; "
Case Ascan( {"TIF","TIFF"},cExt ) > 0
cType := "image/tiff; "
Case Ascan( {"AVI","VFW"},cExt ) > 0
cType := "video/avi; "
Case Ascan( {"DOC","RTF","WBK","DOT","WIZ"},cExt ) > 0
cType := "application/msword; "
Case Ascan( {"RMI","MID","WAV","CDA","MIDI","MP2","MP3","WMA","MJF","MP1","VOC","IT","XM","S3M","STM","MOD","ULT","MTM","HMI","XMI","CMF","MUS","MIZ","HMZ","MSS","GMD","MIDS","HMP"},cExt ) > 0
cType := "audio/mid; "
Otherwise
// *GD* cType := "application/x-unknown-content-type; "
cType := "application/octet-stream; "
EndCase
// ? "|"+cExt+"|",cType
Return cType
Re: Testsmtp.prg FWH9.03
If you've sent AUTH info, but the server doesn't support authentication, you should terminate with ::Failure, not setting the status to ST_QUIT because the socket doesn't receive further data and case ST_QUIT never get fired.
HTH
Davide
Code: Select all
Case ::nStatus == ST_AUTH
If SubStr( cData, 1, 3 ) == "334"
// User and Pass must be encoded in base64
oSocket:SendData( cMimeEnc( ::cUser ) + CRLF )
::nStatus := ST_USER
Else
// *GD* ::nStatus := ST_QUIT
::Failure( oSocket, nWSAError, cReply )
Endif
Davide
Re: Testsmtp.prg FWH9.03
some changes in function DTtoEDT to make it RFC compliant:
Hi,
Davide
Code: Select all
Static Function DTtoEDT( dDate, cTime, nGMT )
// Local aWeek := { "Sun", "Mon", "Tue", "Wed", "Thu", "Fry", "Sat" }
Local aWeek := { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } // 30.03.2010
Local aMonth := { "Jan", "Feb", "Mar", "Apr", "May", "Jun", ;
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
Local cGMT
If nGMT != 0
cGMT := " " + If( nGMT > 0, "+" , "-" ) + StrZero( Abs( nGMT ), 2 ) + "00"
Else
// cGMT := ""
cGMT := " -0000" // 30.03.2010
Endif
Return aWeek[ Dow( dDate ) ] + ", " + LTrim( Str( Day( dDate ) ) ) + " " + ;
aMonth[ Month( dDate ) ] + " " + LTrim( Str( Year( dDate ) ) ) + " " + ;
cTime + cGMT
Davide
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Testsmtp.prg FWH9.03
Davide,
Included for next FWH build, thanks!
Included for next FWH build, thanks!
Re: Testsmtp.prg FWH9.03
Antonio,
Hi,
Davide
I've just sent you the class via e-mail with all the changes made so far (these and others)Antonio Linares wrote:Included for next FWH build, thanks!
Hi,
Davide