this.oMail = NEWOBJECT("sysSendMail","sysSendMail.prg") this.oMail.lcFrom = "Ing. Ricardo Fynn <fynn@c-dev.net>" this.oMail.lcSender = null && We had problems with some servers. Only with 'From' works fine. lcMailTO = "ricardofynn@gmail.com" this.oMail.lcSubject = "This is the mail subject" this.oMail.llHTMLFormat = .T. this.oMail.lcBody = "body text, can be HTML format" this.oMail.lcCC = "somepeople@yahoo.com" this.oMail.lcBCC = null && carbon copy, not used in this sample this.oMail.lcMailServer = "smtp.gmail.com" this.oMail.lcUserName = "ricardofynn" this.oMail.lcPassword = "myPwdHere" this.oMail.lnPort = 587 && more usual is port 25 this.oMail.laAttach[1] = "C:\DOCS\myDocument.doc" this.oMail.SendViaCDOSYSPart of our class code (base in SendViaCDOSSYS) the method Send...
PROCEDURE SendViaCDOSYS AS void LOCAL lcSchema, loAtt, lnCountAttachments PRIVATE loConfig, loMsg TRY lcSchema = "http://schemas.microsoft.com/cdo/configuration/" loConfig = CREATEOBJECT("CDO.Configuration") WITH loConfig.FIELDS .ITEM(lcschema + "smtpserverport") = this.lnPort && SMTP Port .ITEM(lcschema + "sendusing") = 2 && Send it using port . ITEM(lcschema + "smtpserver") = this.lcMailServer && host of smtp server .ITEM(lcschema + "smtpauthenticate") = 1 && Authenticate .ITEM(lcschema + "sendusername") = this.lcUserName && Username .ITEM(lcschema + "sendpassword") = this.lcPassword && Password .UPDATE ENDWITH loMsg = CREATEOBJECT ("CDO.Message") loMsg.configuration = loConfig WITH loMsg .FROM = this.lcFrom .TO = this.lcTo IF TYPE("this.lcSender") = "C" .sender = this.lcSender ENDIF ... and so on>Thanks, I've tryed this..
>oMSG = createobject("CDO.Message") >oMSG.To = "jmartinez@plavicaven.com" >oMSG.From = "jmartinez@plavicaven.com" >oMSG.Subject = "automated email test" >oMSG.AddAttachment("d:\myfile.txt") >oMSG.Send() >>