Bill,

Here's another option. I had tried using CDO for email but couldn't get the
code I had found to work. It turns out there was more to it. Once I found
the other "bones" on MSDN site, it worked fine. (The problem was a missing
property of the schema.) I use it all the time.

Here it is:

* CDOSENDMAIL.PRG
* John Harvey


LPARAMETERS lcemail,lcfile
lcemail=ALLTRIM(LOWER(lcemail))
lcmasteremail='youremailaddressgoeshere'
IF OCCURS('@',lcemail)=0
 RETURN
endif
IF PARAMETERS()<1
 RETURN MESSAGEBOX('Please pass the email address',16,'Error',4)
ENDIF
IF PARAMETERS()<2 && no attachment
 lcfile=''
ENDIF

iMsg = Createobject("CDO.Message")
iConf = Createobject("CDO.Configuration")
Flds = iConf.Fields
 cdoSendUsingPickup = 1 
 cdoSendUsingPort = 2 &&'Must use this to use Delivery Notification'
 cdoAnonymous = 0
 cdoBasic = 1 && clear text
 cdoNTLM = 2 &&NTLM
*Delivery Status Notifications
 cdoDSNDefault = 0 &&'None
 cdoDSNNever = 1 &&'None
 cdoDSNFailure = 2 &&'Failure
 cdoDSNSuccess = 4 &&'Success
 cdoDSNDelay = 8 &&'Delay
 cdoDSNSuccessFailOrDelay = 14 &&'Success, failure or delay

cdobasic=1
With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing";) =
2
        
.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticat";) =
cdoBasic
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver";) =
'YOUREMAILSERVER'
        
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport";) = 25
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusername";)
= "YOUREMAILACCOUNT"
        .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword";)
= "YOUREMAILPASSWORD"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl";) =
.F.
        .Item
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout";) =
60
        .Update
ENDWITH
*SET STEP ON 
With iMsg
        .Configuration = iConf
        .To = lcemail
        .CC = ""
        .BCC = lcmasteremail
        .From = lcmasteremail
        .Subject = "The Subject of your Email"
        .TextBody = "the message you want to send"
        .AddAttachment(lcfile) && LCFILE IS THE FILE YOU ARE ATTACHING
        .Send()
ENDWITH
iMsg = .Null.
iConf = .Null.



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to