I use the following routine using some Rick's classes.
Visit
WWW.West-Wind.com .
*- Parameters.: cMailServer : MAPI Server &&"Pop3.Email.COM"
*- cSenderEmail: Sender E-mail &&"
jzuluaga@MSN.COM"
*- cSenderName : Sender Name &&"Me"
*- cRecipient : Receipient's E-mail && "Email@you.com
*- cCCList : Copy to && "
EAC@msn.com"
*- cSubject : E-mail Subject && "My Test"
*- cMessage : E-mail Message && "See the attachment"
*- cAttachment : E-mail Attachement &&"c:\temp1\report.txt"
*-
*- Objects....:
*-
*------------------------------------------------------------------------------
*- Returns:
*- Variables..:
*------------------------------------------------------------------------------
*- Example:
*- DO MAILTO.PRG
*------------------------------------------------------------------------------
*- Changes....:
*------------------------------------------------------------------------------
PARAMETER cMailServer,cSenderEmail,cSenderName,cRecipient,cCCList,cSubject,cMessage,cAttachment
*-- && wwc Class
#INCLUDE WCONNECT.h
SET PROCEDURE TO wwEval ADDITIVE
SET PROCEDURE TO wwUtils ADDITIVE
SET CLASSLIB TO wwIPStuff ADDITIVE
o=CREATE("wwIPStuff")
SET MEMOWIDTH TO 200
*** Sending SMTP Mail
o.cMailServer=cMailServer
o.cSenderEmail=cSenderEmail
o.cSenderName=cSenderName
o.cRecipient=cRecipient
o.cCCList=cCCList
o.cBCCList=""
o.cSubject=cSubject
o.cMessage=cMessage
o.cAttachment=cAttachment
*- Don't keep the e-mail in the outlook or outlook express
*? o.SendMailAsync() && Send message and return immediately w/o result
llResult = o.SendMail() && Send again - wait for completion
*- This method use the current Microsoft MAPI Protocol. You can see
*- the messages in the outlook or outlook express.
*llResult = o.SendMapiMail()
IF !llResult
WAIT WINDOW "E-mail error:"+o.cErrorMsg
RETURN .F.
ELSE
WAIT WINDOW NOWAIT "Message sent..."
RETURN .T.
ENDIF
Juan C.
"Anyone who has never made a mistake has never tried anything new." A.E
"The important thing is not to stop questioning. Curiosity has its own reason for existing." A.E