#define TRUE .t. #define FALSE .f. #include && the cdo constants of a previous message && need win2k or higher hidden function MailSmtp(Recipient, cc, bcc, subject, msg, attachment) *_Show, 'sending mail to ', m.Recipient, ' Subject:', m.Subject local Success Success = TRUE local ObjMsg, ObjConfig, i, aa[1] ObjMsg = CreateObject('CDO.Message') ObjConfig = CreateObject('CDO.Configuration') do case case !inlist(vartype(m.ObjMsg), T_OBJECT) assert FALSE Success = FALSE case !inlist(vartype(m.ObjConfig), T_OBJECT) assert FALSE Success = FALSE otherwise && (1) config with m.ObjConfig.Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort .Item(cdoSMTPServer) = this.smtpServer && relay.skynet.be .Item(cdoSendUserName) = this.smtpUserId && GregoryAdam@skynet.be .Item(cdoSendPassword) = this.smtPassword && haha .Item(cdoSMTPServerPort) = this.smtpServerPort && 25 .Item(cdoSMTPAuthenticate) = 1 && cdobasic #if FALSE if( !IsRunTime()) && .Item(cdoImportance) = 2 && .Item(cdoPriority) = cdoPriorityUrgent endif #endif .Update() endwith && (2) Message with ObjMsg .Configuration = m.ObjConfig ** .From = 'test@test.com' .To = m.Recipient *.ReplyTo = 'test@test.com' .CC = iif(empty(m.cc), '', m.cc) .bcc = iif(empty(m.bcc), '', m.bcc) .subject = iif(empty(m.subject), '', m.subject) .TextBody = iif(empty(m.msg), '', m.msg) && StringToArray splits comma separated items into an array. Use alines() if( !empty(m.attachment) ) for i = 1 to StringToArray(m.attachment, @aa) && If msg empty and my first attachment is htm/html, then I consider it to be the html body && used to do that in the past. Had only one html attachment do case case (m.i = 1) and empty(m.msg) and inlist(lower(justext(aa[m.i])), 'htm', 'html') .HTMLbody = FileToStr(aa[m.i]) otherwise .AddAttachment(aa[m.i]) endcase endfor endif if( empty(.Configuration.fields.Item(cdoSendEmailAddress).Value) ) .Configuration.fields.Item(cdoSendEmailAddress) = 'No@Profile.com' local FromId FromId = ["] + sys(0) + [" <No@Profile.com>] *FromId = strtran(m.FromId, '(', '\(') *FromId = strtran(m.FromId, ')', '\)') .From = m.FromId endif #if FALSE if( DEBUGMODE_GLOBAL ) acti screen ?'cdoSendEmailAddress', .Configuration.fields.Item(cdoSendEmailAddress).Value ?'cdoSendUserName', .Configuration.fields.Item(cdoSendUserName).Value ?'cdoSendUserReplyEmailAddress', .Configuration.fields.Item(cdoSendUserReplyEmailAddress).Value ? ?'cdoPostUserName', .Configuration.fields.Item(cdoPostUserName).Value ?'cdoPostUserReplyEmailAddress', .Configuration.fields.Item(cdoPostUserReplyEmailAddress).Value endif #endif Private MailQueue_SMTP_Error MailQueue_SMTP_Error = FALSE local sError sError = on('Error') on error MailQueue_SMTP_Error = TRUE *=.SaveToFile('\tmp\00.eml') =.Send() on error &sError do case case m.MailQueue_SMTP_Error =aerror(ppp) disp memo like ppp Success = FALSE endcase endwith endcase return Success endfunc *---------------------------------------------------------------------------