R
RoyT
Hi
I am trying to send an email from within ACCESS using automation to send the
email via Outlook.
I have set up the code and I can send the email but I want the image in my
email to be 'clickable' so that when the user clicks on the image they get
taken to a website. It all works OK but the user cannot see the image. I
obviously need to embed the image in the email somehow. Can anyone help
please???
The code I am using is:
Set objOutlook = New Outlook.Application
Set db = CurrentDb()
Set qryDef = db.QueryDefs("qryMail")
qryDef.Parameters(0) = Me.cmbPostCode.Value
Set rstMail = qryDef.OpenRecordset
Do Until rstMail.EOF
' This creates the e-mail
Set objMail = objOutlook.CreateItem(olMailItem)
' This addresses it
objMail.To = rstMail("Email")
'This gives it a subject
objMail.Subject = strSubject
'This gives it the body
objMail.HTMLBody = "<html><head><meta http-equiv='Content-Type'
content='text/html; charset=windows-1252'>" _
& "<title>New Page 1</title></head><body><p><a
href='http://www.rothco.co.uk'><img border='0'
src='file:///C:/Clients/Roy/email%20front12.gif' width='960'
height='720'></a></p>" _
& "</body></html>"
objmail.Send
'objMail.Display
'And on to the next one...
rstMail.MoveNext
Loop
Set objOutlook = Nothing
Set db = Nothing
Set qryDef = Nothing
Set rstMail = Nothing
Set objMail = Nothing
I am trying to send an email from within ACCESS using automation to send the
email via Outlook.
I have set up the code and I can send the email but I want the image in my
email to be 'clickable' so that when the user clicks on the image they get
taken to a website. It all works OK but the user cannot see the image. I
obviously need to embed the image in the email somehow. Can anyone help
please???
The code I am using is:
Set objOutlook = New Outlook.Application
Set db = CurrentDb()
Set qryDef = db.QueryDefs("qryMail")
qryDef.Parameters(0) = Me.cmbPostCode.Value
Set rstMail = qryDef.OpenRecordset
Do Until rstMail.EOF
' This creates the e-mail
Set objMail = objOutlook.CreateItem(olMailItem)
' This addresses it
objMail.To = rstMail("Email")
'This gives it a subject
objMail.Subject = strSubject
'This gives it the body
objMail.HTMLBody = "<html><head><meta http-equiv='Content-Type'
content='text/html; charset=windows-1252'>" _
& "<title>New Page 1</title></head><body><p><a
href='http://www.rothco.co.uk'><img border='0'
src='file:///C:/Clients/Roy/email%20front12.gif' width='960'
height='720'></a></p>" _
& "</body></html>"
objmail.Send
'objMail.Display
'And on to the next one...
rstMail.MoveNext
Loop
Set objOutlook = Nothing
Set db = Nothing
Set qryDef = Nothing
Set rstMail = Nothing
Set objMail = Nothing