by Rick Lipkin » Thu Jul 31, 2008 7:59 pm
Antonio
Just found some strange behavior in the tsmtp class .. I have a folder on our web server that has domain READ rights for our Agency. My executable launches from that domain folder
\\webdev\pmo\pmow32.exe
I have a file I wish to attach
c:\dbtmp\projinfo.bat
When a user runs the program and the application attaches c:\dbtmp\projinfo.bat .. the file gets delivered with zero bytes. What is strange is that when I run the application and the program sends the same attachment .. the message gets delivered with the attachment intact.
What I have deduced is that I have full rights to the \\webdev\pmo folder and regular users do not ( which is the way I want it ) .. I can send the attachments and they arrive, but no one else can. My guess is the tsmtp is copying the c:\dbtmp\projinfo.txt file to the exe location and since no one has rights there .. the file gets created with zero bytes and gets delivered that way.
I have been going crazy over this ... is there a way you can look at the class and see what is happening there .. does the attachment have to reside or does it get copied to the exe location in order to be sent ??
Is the attachment flowing theu a socket from the executable ?? This mystery definitly has to do with permissions in the executable folder..
Any hints or clues ?? .. ps, this is not a virus stripping issue .. it has been turned off.
Rick Lipkin
SC Dept of Health, USA
Here is the code snipit ..
// create the attachment on the local hard drive //
FERASE( "C:\DBTMP\PROJINFO.BAT")
cTEXT := "@ECHO OFF"+CHR(13)+CHR(10)
cTEXT += "echo Starting the PMO Strategic Projects Vital Signs Program"+CHR(13)+CHR(10)
cTEXT += cLINK+" /projecteid="+oRsproj:Fields("projecteid"):Value+CHR(13)+CHR(10)
nHANDLE := FCREATE( "C:\DBTMP\PROJINFO.BAT", 0 )
IF FERROR() <> 0
SAYING := "Error Creating file C:\DBTMP\ProjInfo.BAT"+CHR(10)
SAYING += "Error "+STR(FERROR())+CHR(10)
MsgInfo( SAYING )
ENDIF
FWRITE( nHANDLE, cTEXT ) // write out the file
FCLOSE( nHANDLE )
SysReFresh()
oWndMdi:SetMsg( "Sending Project ADD noticication to "+cTO )
WSAStartup()
oOutMail := TSmtp():New( cIP := GetHostByName( cHOST ) )
oOutMail:bConnecting = { || oWndMdi:SetMsg( "Connecting to "+cHOST ) }
oOutMail:bConnected = { || oWndMdi:SetMsg( "Connected" ) }
oOutMail:bDone = { || oWndMdi:SetMsg( "Message sent successfully" ) }
oOutMail:SendMail( cFROM,; // From
{ cTO },; //, cPMOEMAIL, cSPOEMAIL },; // To
cMESSAGE,; // Msg Text
cSUBJECT,;
{"C:\DBTMP\PROJINFO.BAT"},; // attachment
{ cSPOEMAIL, cPMOEMAIL }, ; // cc
{ }, ; // bc
.F., ; // no return receipt
NIL ) // not html
SysReFresh()