Versions des environnements
It worked after put 2 enter keystroke... Thanks...
>>>>Use blat. It's a freeware e-mail sender. It needs nothing. I used it after Cetin's advice. It's work excellent. Thanks him...
>>>>
>>>
>>>I agree. Do a google search for blat.dll. It is very reliable, free, and does not require ANY mail client on the machine. It is its' own SMTP engine - all you need to do is tell it where a mail server is that it can relay through.
>>>
>>>I can provide a VFP class for using it if you need it.
>>
>>A class would be better... Thanks... :)
>
>Here is what I use. NOTE: Blat needs to be initialized with SMTP Server address, SMTP Port, and max retry count. This can be done in the initial setup of BLAT, or you can add entries directly to the registry (I can send you the registry entries if you need them).
>
>The class..(I hope this posts correctly - If needed, I can EMAIL it to you)
>
>DEFINE CLASS sendblatmail as custom
>************************************
>
>#IF .F.
> LOCAL this as sendblatmail OF blatmail.prg
>#ENDIF
>
> icFrom = ''
> icTo = ''
> icCC = ''
> icBCC = ''
> icSubject = ''
> inReturnCode = 0
> icErrorMessage = ''
> icBodyFile = ''
> icMessageString = ''
> ilSendTheString = .F.
> ilSendTheFile = .F.
> icFiletoAttach = ''
>
> icBlatDllFolder = "C:\program files\blat" *!* set this to where BLAT.DLL is located
>
> icSMTP_Server = 'mail.myserver.com' *!* use the address of your SMTP server here
>
>
>*********************************************************
> FUNCTION init(tcBlatDllFolder,tcFrom,tlSendTheString)
>*********************************************************
> LOCAL lcBlatDllFile
>
> IF !EMPTY(tcBlatDllFolder)
> this.icBlatDllFolder = ADDBS(TRIM(tcBlatDllFolder))
> ENDIF
>
> IF !EMPTY(tcFrom)
> this.icFrom = TRIM(tcFrom)
> endif
>
> IF EMPTY(tlSendTheString)
> this.ilSendTheString = .F.
> this.ilSendTheFile = .T.
> ELSE
> this.ilSendTheString = tlSendTheString
> this.ilSendTheFile = !tlSendTheString
> ENDIF
>
> lcBlatDllFile = ADDBS(TRIM(this.icBLATDLLFOLDER))+"BLAT.DLL"
>
> IF !FILE(lcBlatDLLFile)
> RETURN .F.
> ENDIF
>
> CLEAR DLLS Send
>
> DECLARE INTEGER Send in &lcBlatDllFile STRING blatstring
>
>*********************************************************
> ENDFUNC && INIT
>*********************************************************
>
>
>*********************************************************
> FUNCTION send(tcTo,tcCC,tcBCC,tcSubject,tcMessageString,tcBodyFile,tlSendTheString,tcFileToAttach,tcFrom)
>*********************************************************
>
> LOCAL llRetVal
> LOCAL lcBlatCommandString
> LOCAL lnResult
>
>
> IF EMPTY(tcTo) AND EMPTY(this.icTO) && nowhere to send!
> this.inReturnCode = -1
> this.icErrorMessage = 'TO is not specified!'
> RETURN .F.
> ELSE
> IF !EMPTY(tcto)
> this.icto = ALLTRIM(tcTo)
> endif
> endif
>
> IF !EMPTY(tcCC)
> this.icCC = tcCC
> ENDIF
>
> IF !EMPTY(tcBCC)
> this.icBCC = tcBCC
> endif
>
> IF !EMPTY(tcSubject)
> this.icSubject = TRIM(tcSubject)
> ENDIF
>
> IF !EMPTY(tcMessageString)
> this.icMessageString = TRIM(tcMessageString)
> endif
>
> IF !EMPTY(tcBodyFile)
>
> this.icBodyFile = allTRIM(tcBodyFile)
>
> IF !FILE(tcBodyFile)
> this.inReturnCode = -1
> this.icErrorMessage = 'Message Body File "' + tcBodyFile + '" does not exist!'
> RETURN .f.
> ENDIF
>
> ENDIF
>
> IF !EMPTY(tlSendTheString)
> this.ilSendtheString = tlSendTheString
> this.ilSendTheFile = !tlSendTheString
> endif
>
> IF !EMPTY(tcFileToAttach)
>
> this.icFileToAttach = tcFileToAttach
>
> endif
>
> lcBlatCommandString = ''
> lnResult = 0
> llRetVal = .F.
>
>
> && build the string
> lcBlatCommandString = IIF(this.ilsenDTHEFILE,this.icBODYFILE+' ','NUL ')
> lcBlatCommandString = lcBlatCommandString + IIF(!EMPTY(this.icTO),'-to '+this.icTO + ' ','')
> lcBlatCommandString = lcBlatCommandString + IIF(!EMPTY(this.icCC),'-cc '+this.icCC+' ','')
> lcBlatCommandString = lcBlatCommandString + IIF(!EMPTY(this.icBCC),'-bcc '+this.icBCC + ' ','')
> lcBlatCommandString = lcBlatCommandString + '-f '+ IIF(!EMPTY(tcFrom),tcFrom,this.icFrom) + ' '
> lcBlatCommandString = lcBlatCommandString + IIF(!EMPTY(this.icsUBJECT),'-s "'+this.icSUBJECT +'" ','')
> lcBlatCommandString = lcBlatCommandString + IIF(this.ilsendthestring,'-body "'+this.icmessagestring+'" ','')
> lcBlatCommandString = lcBlatCommandString + IIF(!EMPTY(this.icFileToAttach),'-attach '+ this.icFileToAttach,'')
>
> WAIT 'Sending mail to '+this.icTo+IIF(!EMPTY(this.iccc),'+ '+this.iccc,'') +IIF(!EMPTY(this.icbcc),'+ '+this.icbcc,'') + '..' WINDOW nowait
>
> lnResult = Send(lcBlatCommandString)
>
> WAIT clear
> IF lnResult = 0
>
> llRetVal = .T.
>
> this.icFrom = ''
> this.icTo = ''
> this.icCC = ''
> this.icBCC = ''
> this.icSubject = ''
> this.icErrorMessage = ''
> this.icBodyFile = ''
> this.icMessageString = ''
> this.ilSendTheString = .F.
> this.ilSendTheFile = .F.
> this.icFiletoAttach = ''
>
> ELSE
> this.inReturnCode = lnResult
> lRetVal = .F.
> endif
>
>
> RETURN llRetVal
>
>*********************************************************
> ENDFUNC && send
>*********************************************************
>
>*********************************************************
> FUNCTION DESTROY
>*********************************************************
>
> CLEAR DLLS Send
>
>*********************************************************
> ENDFUNC && DESTROY
>*********************************************************
>
>*********************************************************
>ENDDEFINE && class sendblatmail
>*********************************************************
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement