A tool to send email ?
A tool to send email ?
Hi friends:
Do you know a very good class, function, lib, dll or tool to send emails from my app, my tools: FWH0810 and xHarbour build 1.1.0 Intl. (SimpLex) (Rev. 6195)?
With best regards
Do you know a very good class, function, lib, dll or tool to send emails from my app, my tools: FWH0810 and xHarbour build 1.1.0 Intl. (SimpLex) (Rev. 6195)?
With best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
Thanks a lot Enrico.
Is it possible a small sample
Best regards
Is it possible a small sample
Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
Here it is:
EMG
Code: Select all
#include "Fivewin.ch"
STATIC hLib
FUNCTION MAIN()
LOCAL cFrom := ""
LOCAL cServer := ""
LOCAL cTo := ""
LOCAL cSubjeCt := ""
LOCAL cMessage := ""
LOCAL cSender := ""
LOCAL cUser := ""
LOCAL cPassword := ""
? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUser, cPassword )
RETURN NIL
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification )
LOCAL cMsgFile := CTEMPFILE()
LOCAL cCmd := "SndMail -f " + cFrom + " -X " + cServer + " -r " + cTo + " -s " + ["] + cSubject + ["] + " -b " + cMsgFile
LOCAL nRes
LOCAL i
DEFAULT lHtml := "<html" $ LOWER( cMessage )
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
IF !EMPTY( lNotification )
cCmd += " -t " + ["] + "Disposition-Notification-To: " + cFrom + ["]
ENDIF
hDLL = LOADLIBRARY( "sndmail.dll" )
SMTPLIBOPEN()
nRes = SMTPSENDMAIL( cCmd )
SMTPLIBCLOSE()
FREELIBRARY( hDLL )
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
Re: A tool to send email ?
Enrico:
Thanks so much for your sample, I'll test it.
Best regards
Thanks so much for your sample, I'll test it.
Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Re: A tool to send email ?
Enrico,
thanks a lot for the sample and your help !!!
Armando,
change hDLL for hLib.
Best regards,
Felix
thanks a lot for the sample and your help !!!
Armando,
change hDLL for hLib.
Best regards,
Felix
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
Sorry, my fault.Baxajaun wrote:change hDLL for hLib.
EMG
- Willi Quintana
- Posts: 859
- Joined: Sun Oct 09, 2005 10:41 pm
- Location: Cusco - Perú
- Contact:
Re: A tool to send email ?
Hi friends...
came out this error when compiling
Error: 'D:\SOFT\SNDMAIL\SNDMAIL-2.5\SNDMAIL.LIB' contains invalid OMF record,
came out this error when compiling
Error: 'D:\SOFT\SNDMAIL\SNDMAIL-2.5\SNDMAIL.LIB' contains invalid OMF record,
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
You don't have to link sndmail.lib. Use sndmail.dll only.
EMG
EMG
- Willi Quintana
- Posts: 859
- Joined: Sun Oct 09, 2005 10:41 pm
- Location: Cusco - Perú
- Contact:
Re: A tool to send email ?
Hi,,, (thanks Giordano)
any example with hotmail???
this is my code:
return .F.
suggestions??
any example with hotmail???
this is my code:
Code: Select all
cFrom := "cliente@hotmail.com"
cServer := "smtp.live.com"
cTo := "willi@hotmail.com"
cSubject := "error system"
cMessage := memoread("error.log")
cSender := ""
cUserm := "cliente"
cPassm := "12345678"
? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUserm, cPassm )
suggestions??
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
My name is Enrico.Willi Quintana wrote:Hi,,, (thanks Giordano)
No, sorry. It should work. Does it work using Outlook or similar email apps?Willi Quintana wrote:any example with hotmail???
EMG
Re: A tool to send email ?
hotmail
-P port Set SMTP port { 25 }
port 25 or 995
-P port Set SMTP port { 25 }
port 25 or 995
Daniel Lopes Filho - Campo Grande,MS,Brasil
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6693) + gtwvw + fw 10.2 + vsx e
fw pcc (ainda não usei)
msn : zazibr@hotmail.com
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6693) + gtwvw + fw 10.2 + vsx e
fw pcc (ainda não usei)
msn : zazibr@hotmail.com
Re: A tool to send email ?
Enrico,
I tested Your sample, but nothing happens
FUNCTION MAIN()
// AOL SMTP-Server ( infos from internet ):
// smtp.de.aol.com for emails ending with aol.com
// login for the SMTP-Server is needed.
// username and password
LOCAL cFrom := "Uwe"
LOCAL cServer := "smtp.de.aol.com"
LOCAL cTo := "esckoenig@aol.com" // my email for testing the mailbox for incomming emails
LOCAL cSubjeCt := "Test"
LOCAL cMessage := "Test"
LOCAL cSender := "Uwe"
LOCAL cUser := "aoluser" // adding my username
LOCAL cPassword := "aolpassword" // adding my password
? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUser, cPassword )
RETURN NIL
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification )
...
...
maybe something missing or not possible to use it ?
or is there maybe another working sample in the meantime
because the post is dated 2011 ?
regards
Uwe
I tested Your sample, but nothing happens
FUNCTION MAIN()
// AOL SMTP-Server ( infos from internet ):
// smtp.de.aol.com for emails ending with aol.com
// login for the SMTP-Server is needed.
// username and password
LOCAL cFrom := "Uwe"
LOCAL cServer := "smtp.de.aol.com"
LOCAL cTo := "esckoenig@aol.com" // my email for testing the mailbox for incomming emails
LOCAL cSubjeCt := "Test"
LOCAL cMessage := "Test"
LOCAL cSender := "Uwe"
LOCAL cUser := "aoluser" // adding my username
LOCAL cPassword := "aolpassword" // adding my password
? SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, , cSender, cUser, cPassword )
RETURN NIL
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification )
...
...
maybe something missing or not possible to use it ?
or is there maybe another working sample in the meantime
because the post is dated 2011 ?
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: A tool to send email ?
I don't use sndmail.dll any longer. Now I'm using CDO.Message:
EMG
Code: Select all
FUNCTION SENDMAIL( cFrom, cServer, cTo, cSubject, cMessage, aAttach, cSender, cUser, cPassword, aCc, lHtml, cPort, lNotification, lSSL )
LOCAL lOk := .F.
LOCAL oCfg, oMsg
LOCAL cCc := ""
LOCAL i
DEFAULT lHtml := "<html" $ LOWER( cMessage )
DEFAULT lNotification := .F.
DEFAULT lSSL := .F.
TRY
oCfg = CREATEOBJECT( "CDO.Configuration" )
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value = cServer
IF !EMPTY( cPort )
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := VAL( cPort )
ENDIF
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value = 2
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .F.
IF !EMPTY( cUser ) .AND. !EMPTY( cPassword )
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value = .T.
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value = cUser
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := cPassword
oCfg:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value = lSSL
ENDIF
oCfg:Update()
oMsg = CREATEOBJECT( "CDO.Message" )
oMsg:Configuration = oCfg
IF !EMPTY( cSender )
cFrom = ["] + cSender + ["] + " <" + cFrom + ">"
ENDIF
oMsg:From = cFrom
oMsg:To = cTo
oMsg:Subject = cSubject
IF !EMPTY( aCc )
FOR i = 1 TO LEN( aCc )
IF i > 1
cCc += ";"
ENDIF
cCc += aCc[ i ]
NEXT
oMsg:CC = cCc
ENDIF
IF !lHtml
oMsg:TextBody = cMessage
ELSE
oMsg:HTMLBody = cMessage
ENDIF
IF !EMPTY( aAttach )
FOR i = 1 TO LEN( aAttach )
oMsg:AddAttachment( aAttach[ i ] )
NEXT
ENDIF
IF lNotification
oMsg:Fields:Item( "urn:schemas:mailheader:disposition-notification-to" ):Value = cFrom
oMsg:Fields:Update()
ENDIF
oMsg:Send()
lOk = .T.
CATCH
END
RETURN lOk
Re: A tool to send email ?
Enrico,
thank You very much for the sample.
I will add it to my downloadsection and test it
regards
Uwe
thank You very much for the sample.
I will add it to my downloadsection and test it
regards
Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.