Send email from access with an attachment

  • Thread starter Thread starter ielmrani
  • Start date Start date
I

ielmrani

I have a table like this:

Client ContactName Email
ABC ABC Name (e-mail address removed)
CDC CDC Name (e-mail address removed)
MNB MNB Name (e-mail address removed)

I am trying to send an email and attach a card (jpg file) to the above
clients using the email address in the email field.
maybe creating a button in a form and when clicked the emails are sent.

Thanks
 
I have a table like this:

Client ContactName Email
ABC ABC Name (e-mail address removed)
CDC CDC Name (e-mail address removed)
MNB MNB Name (e-mail address removed)

I am trying to send an email and attach a card (jpg file) to the above
clients using the email address in the email field.
maybe creating a button in a form and when clicked the emails are sent.

Thanks

Here is an example:
Set o = CreateObject("Outlook.Application")

Set m = o.CreateItem(0)
m.To = "Paul Tucker" ' The distribution list name goes here
m.Subject = "SUPP Analysis Spreadsheet "
m.body = Chr(13) & Chr(13) & _
" Date: " & date & Chr(13) & _
Chr(13)
m.attachments.Add ReportDir & exportName ' point to the full address
of attachment here
' There can be multiple of the above
' m.display ' display shows email and the user has to press send
button
m.send ' Send does it automatically with security from Outlook
set m = nothing
set o = nothing

Ron
 
If you are trying to email information from an access object such as a table,
query, report,... then SendObject is the way to go.

DoCmd.SendObject ...............

Look it up in the help file for all the details and examples.

On the other hand if you wish to send e-mail with attachments that are not
access objects, so items like images (jpg), pdfs, etc. then you need to use
another method such as automating Outlook. For this look at

http://msdn2.microsoft.com/en-us/li...odc_ac_olauto_sendanoutlookmessageusingaccess

For a list of other methods available to you regarding sending emails from
access refer to

http://www.granite.ab.ca/access/email.htm
 
Back
Top