If you're on an NT-based machine (NT, 2K, XP) it doesn't get any easier
than using CDONTS. The machine must be running the SMTP service and have
access to the internet. You will also need to add a reference to the CDO
library within Access. After this, it's as simple as:
Dim oEMail As New CDONTS.EMail
oEMail.From "an*****@anydom ain.com"
oEMail.To "yo*******@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
Or, if you access to an SMTP server, you might try this CDO routine. You
will still need a reference to 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
For a great overview of the many options for email with Access check out
Tony Toews'
website:
http://www.granite.ab.ca/access/email.htm
HTH
Pat
"bill mahoney" <bi***@alcottgr oup.com> wrote in message
news:fa******** *************** ***@posting.goo gle.com...
Hello,
I am using access 2000 and I am trying to email a csv file. I have
only used the docmd.sendobjec t command but you can only email objects
that are within the access database ( as far as I can tell anyway). I
need to email a file that is not in my database. Is there another way
I can send an email without using sendobject that would allow me to do
this. Thanks for any help.
Regards,
Bill Mahoney