Testsmtp.prg FWH9.03

Testsmtp.prg FWH9.03

Postby Davide » Mon Apr 06, 2009 11:50 pm

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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Davide » Tue Apr 07, 2009 12:20 am

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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Davide » Fri Apr 10, 2009 11:23 pm

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=")

Code: Select all  Expand view
                    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)


Hi,
Davide
xH 1.2.1 - FWH 9.04
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Antonio Linares » Sat Apr 11, 2009 10:01 am

Davide,

Thanks for the info! :-)

Yes, 9.03 uses the most recent one, as far as we know it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41441
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Testsmtp.prg FWH9.03

Postby Davide » Sat Apr 11, 2009 10:27 am

Antonio,
Antonio Linares wrote:Thanks for the info! :-)

Yes, 9.03 uses the most recent one, as far as we know it.

ok, I'll continue posting the modifications here, should I find other improvements.
Thank you,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.04

Postby Davide » Fri May 29, 2009 5:01 pm

ok, I'll continue posting the modifications here, should I find other improvements.

I've changed the DocType function as follows, because the previous method didn't work correctly for some extensions.

HTH
Davide

Code: Select all  Expand view
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Davide » Mon Oct 12, 2009 1:31 am

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.

Code: Select all  Expand view
    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
 


HTH
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Davide » Tue Mar 30, 2010 3:33 pm

some changes in function DTtoEDT to make it RFC compliant:

Code: Select all  Expand view
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


Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Testsmtp.prg FWH9.03

Postby Antonio Linares » Mon Apr 05, 2010 2:54 am

Davide,

Included for next FWH build, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41441
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Testsmtp.prg FWH9.03

Postby Davide » Tue Apr 06, 2010 1:05 am

Antonio,
Antonio Linares wrote:Included for next FWH build, thanks! :-)

I've just sent you the class via e-mail with all the changes made so far (these and others)
Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests