I am hoping to be able to avoid the Outlook security problem by using
CDONTS and I tried using the code below (with appropriate change to
the address etc):
Dim oEMail As New CDONTS.EMail
oEMail.From "anyn...@anydom ain.com"
oEMail.To "yourem...@your domain.com"
oEMail.BodyForm at = CdoBodyFormatTe xt
oEMail.Body = "Insert some useful text here"
oEMail.Importan ce = CdoHigh
oEMail.AttachFi le "C:\filename.tx t"
oEMail.Send
There was no reference to CDO in the References so selected CDO.
Code didn't work (CDONTS.email unrecognised).
I then tried:
Sub SendEmail()
Const MailSender as String = "sender @ yourdomain.com"
Const MailRecipient as String = "recipient @ anotherdomain.c om"
Const MailCCRecipient as String = "cc @ anotherdomain.c om"
Const MailSubject as String = "Here's an email with an attachment"
Const MailBody as Strnig = "See the attachment"
Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configurati on
Dim Flds as New CDO.Fields
Dim strAttachment as String
strAttachment = "C:\somefile.tx t"
With Flds
.Item(cdoSMTPSe rver) = "ip address or name of smtp server"
.Item(cdoSMTPSe rverPort) = 25 ' typically
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Item(cdoSMTPCo nnectionTimeout ) = 200
.Item(cdoSMTPAu thenticate) = cdoNTLM
End With
With iMsg
Set .Configuration = iConf
.To = MailRecipient
.CC = MailCCRecipient
.From = MailSender
.Subject = MailSubject
.TextBody = MailBody
.AddAttachment (strAttachment)
.MDNRequested = True 'return receipt on
.Send
End With
End Sub
Didn't work. Stopped at the first Dim statement. I definitely have
CDO referenced.
Anyone able to help? e.g. how do I get the CDONTS method to work
(looks simpler) or what is wrong with the CDO method?
Win XP, Access 2002.
Thanks
Jeff B.
CDONTS and I tried using the code below (with appropriate change to
the address etc):
Dim oEMail As New CDONTS.EMail
oEMail.From "anyn...@anydom ain.com"
oEMail.To "yourem...@your domain.com"
oEMail.BodyForm at = CdoBodyFormatTe xt
oEMail.Body = "Insert some useful text here"
oEMail.Importan ce = CdoHigh
oEMail.AttachFi le "C:\filename.tx t"
oEMail.Send
There was no reference to CDO in the References so selected CDO.
Code didn't work (CDONTS.email unrecognised).
I then tried:
Sub SendEmail()
Const MailSender as String = "sender @ yourdomain.com"
Const MailRecipient as String = "recipient @ anotherdomain.c om"
Const MailCCRecipient as String = "cc @ anotherdomain.c om"
Const MailSubject as String = "Here's an email with an attachment"
Const MailBody as Strnig = "See the attachment"
Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configurati on
Dim Flds as New CDO.Fields
Dim strAttachment as String
strAttachment = "C:\somefile.tx t"
With Flds
.Item(cdoSMTPSe rver) = "ip address or name of smtp server"
.Item(cdoSMTPSe rverPort) = 25 ' typically
.Item(cdoSendUs ingMethod) = cdoSendUsingPor t
.Item(cdoSMTPCo nnectionTimeout ) = 200
.Item(cdoSMTPAu thenticate) = cdoNTLM
End With
With iMsg
Set .Configuration = iConf
.To = MailRecipient
.CC = MailCCRecipient
.From = MailSender
.Subject = MailSubject
.TextBody = MailBody
.AddAttachment (strAttachment)
.MDNRequested = True 'return receipt on
.Send
End With
End Sub
Didn't work. Stopped at the first Dim statement. I definitely have
CDO referenced.
Anyone able to help? e.g. how do I get the CDONTS method to work
(looks simpler) or what is wrong with the CDO method?
Win XP, Access 2002.
Thanks
Jeff B.