Moderator: Enrico Maria Giordano
STATIC hLib
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort )
LOCAL cMsgFile := GETNEWFNAME()
LOCAL cCmd := "SndMail -f " + cFrom + " -X " + cServer + " -r " + cTo + " -s " + ["] + cSubject + ["] + " -b " + cMsgFile
LOCAL nRes
LOCAL i
DEFAULT lHtml := .F.
MEMOWRIT( cMsgFile, cMessage + CRLF )
IF !EMPTY( aAttach )
FOR i = 1 TO LEN( aAttach )
cCmd += " -a " + ["] + aAttach[ i ] + ["]
NEXT
ENDIF
IF !EMPTY( cSender )
cCmd += " -F " + ["] + cSender + ["]
ENDIF
IF !EMPTY( cUser )
cCmd += " -h LOGIN -u " + cUser
ENDIF
IF !EMPTY( cPassword )
cCmd += " -p " + cPassword
ENDIF
IF !EMPTY( aCc )
FOR i = 1 TO LEN( aCc )
cCmd += " -c " + ["] + aCc[ i ] + ["]
NEXT
ENDIF
IF lHtml
cCmd += " -H"
ENDIF
IF !EMPTY( cPort )
cCmd += " -P " + cPort
ENDIF
hLib = LOADLIB32( "sndmail.dll" )
SMTPLIBOPEN()
nRes = SMTPSENDMAIL( cCmd )
SMTPLIBCLOSE()
FREELIB32( hLib )
FERASE( cMsgFile )
RETURN nRes = 0
DLL STATIC FUNCTION SMTPLIBOPEN() AS VOID;
PASCAL FROM "USmtpLibOpen" LIB hLib
DLL STATIC FUNCTION SMTPSENDMAIL( cCmd AS STRING ) AS LONG;
PASCAL FROM "USmtpCmdLineSendMail" LIB hLib
DLL STATIC FUNCTION SMTPLIBCLOSE() AS VOID;
PASCAL FROM "USmtpLibClose" LIB hLib
Massimo Linossi wrote:Ciao EMG.
Due domande.
1. Dove si trova la dll che stai usando ?
Massimo Linossi wrote:2. C'è la possibilità di controllare se l'indirizzo email che vuoi usare esiste ?
Return to All products support
Users browsing this forum: No registered users and 12 guests