David,
You are absolutely right about the blackholes listings - this could indeed
be a problem with the CDONTS function on Tony's site. I've actually had
great success however with another function using the CDO library:
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
This routine does allow you to specify the IP address (or UNC) for a valid
SMTP server - just make sure it's accepting mail relay from your IP! You'll
notice a method for CDO.Fields that allows for authentication. This
function has an extra flair in that you can set a flag for return receipt,
but we all now how easily a recipient can block that. However, you will
have to have SMTP Service configured on the machine running the routine -
just add the service and have your windows setup CD handy - you'll basically
be installing the IIS component.
Hope this works for you. I've found it to be a nice work around to avoid
patching Outlook so as not to get the security warnings. Curious to hear if
you have other problems or reservations about this routine.
Pat
"David W. Fenton" <dX********@bwa y.net.invalid> wrote in message
news:Xn******** *************** ***********@24. 168.128.86...
"Pat" <no*****@ihates pam.bum> wrote in
news:_V******** *********@fe1.t exas.rr.com:
Tony Toews has a great FAQ on email that should give you some
options. My personal favorite is CDONTS, since it's so simple.
http://www.granite.ab.ca/access/email.htm
Keep in mind, though, that if the machine you're sending it from
does not have a fixed IP address, any recipient whose ISP is using
one of the real-time black holes that includes all dynamic IP host
addresses will likely classify your messages as spam, and may even
simply reject the email entirely.
You many never know if your email message failed to get to the
recipient.
Perhaps it's possible to control CDONTS in a fashion that you can
specify your ISP's SMTP server as the only relay it uses, and
perhaps you can have CDONTS authenticate on that SMTP server. If
that's the case, that would be a safe and reliable method for
sending email.
However, I don't seen any SMTP service on my Win2K workstation, and
Tony's code fails to work (even after I fix the errors in it, where
it lacks "=" for setting properties).
It doesn't seem as though there's any way to control the SMTP server
it connects to, I see now that I have tested it, so it probably
isn't really usable after all.
Most of my clients are happy with SENDOBJECT, because their SENT
MESSAGES folder in their email client then has a copy of the mail
they send out. SENDOBJECT also uses your default email client's SMTP
settings, so it's not going to generate messages that are likely to
get rejected as spam.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc