WITH This .ClearErrors() .oCfg = CREATEOBJECT("CDO.Configuration") .oMsg = CREATEOBJECT("CDO.Message") .oMsg.Configuration = This.oCfg ENDWITH && Fill message attributes LOCAL lnind, laList[1], loHeader, laDummy[1] IF This.SetConfiguration() > 0 This.AddError("Configuration Failure.") ENDIF IF This.GetErrorCount() = 0 IF EMPTY(This.cFrom) This.AddError("ERROR : From is Empty.") ENDIF IF EMPTY(This.cSubject) This.AddError("ERROR : Subject is Empty.") ENDIF IF EMPTY(This.cTo) AND EMPTY(This.cCC) AND EMPTY(cBCC) This.AddError("ERROR : To,CC and BCC all are Empty.") ENDIF ENDIF IF This.GetErrorCount() = 0 This.SetHeader() WITH This.oMsg .From = This.cFrom .ReplyTo = This.cReplyTo .To = This.cTo .CC = This.cCC .BCC = This.cBCC .Subject = This.cSubject *-- Clear attachements .Attachments.DeleteAll() *-- Clear Text Body .TextBody = "" *-- Clear HTML Body .HTMLBody = [] && Create HTML body from external HTML (file, URL) IF NOT EMPTY(This.cHtmlBodyUrl) .CreateMHTMLBody(This.cHtmlBodyUrl) ENDIF && Send HTML body. Creates TextBody as well IF NOT EMPTY(This.cHtmlBody) .HtmlBody = This.cHtmlBody ENDIF && Send Text body. Could be different from HtmlBody, if any IF NOT EMPTY(This.cTextBody) .TextBody = This.cTextBody ENDIF .TextBody = "I plugged this" WAIT WINDOW .TextBody && Process attachments IF NOT EMPTY(This.cAttachment) && Accepts comma, semicolon FOR lnind=1 TO ALINES(laList, This.cAttachment, [,], [;]) lcAttachment = ALLTRIM(laList[lnind]) && Ignore empty values IF EMPTY(laList[lnind]) LOOP ENDIF && Make sure that attachment exists IF ADIR(laDummy, lcAttachment) = 0 This.AddError("ERROR: Attacment not Found - " + lcAttachment) ELSE && The full path is required. IF UPPER(lcAttachment) <> UPPER(FULLPATH(lcAttachment)) lcAttachment = FULLPATH(lcAttachment) ENDIF .AddAttachment(lcAttachment) ENDIF ENDFOR ENDIF ENDWITH ENDIF IF This.GetErrorCount() = 0 TRY This.oMsg.Send() CATCH TO oErr This.AddOneError("SEND ERROR: ", oErr.ErrorNo, oErr.procedure, oErr.LineNo) ENDTRY ENDIF RETURN This.GetErrorCount()