Hi everybody,
I hope you are all right. I have a couple of questions regarding an access database I have created and that I would like to improve.
This database sends e-mails from access trough outlook.
This is the following code that uses to perform this action:
This are my questions:
1-I am sending this e-mail from my e-mail box, so the "From" is my e-mail name, however, I would like to know if there is any chance of sending the e-mail from my box but the "From" to appear another legend or e-mail.
2-Is there anyway to make this e-mail an HTML e-mail instead of plain text? I know here it appears that the verbiage comes from a table where I have stored the wording, however, could be an image as banner be added and those stuffs?
Thanks and regards!
I hope you are all right. I have a couple of questions regarding an access database I have created and that I would like to improve.
This database sends e-mails from access trough outlook.
This is the following code that uses to perform this action:
Code:
Dim MyDB As Database
Dim MyRS As Recordset
Dim MyTable As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim TheAddress As String
Dim TheBody As String
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("Comunicacion3")
MyRS.MoveFirst
Set MyTable = MyDB.OpenRecordset("Comu3")
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
Do Until MyRS.EOF
' Create the e-mail message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
TheAddress = MyRS![Enterprise]
TheBody = MyTable![Memo]
With objOutlookMsg
' Add the To recipients to the e-mail message.
Set objOutlookRecip = .Recipients.Add(TheAddress)
objOutlookRecip.Type = olBCC
' Set the Subject, the Body, and the Importance of the e-mail message.
.Subject = "Action Required: Review and Accept Your Cross Border Agreement - Second Reminder"
.Body = TheBody
.Importance = olImportanceHigh 'High importance
' Resolve the name of each Recipient.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
MyRS.MoveNext
Loop
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set MyTable = Nothing
This are my questions:
1-I am sending this e-mail from my e-mail box, so the "From" is my e-mail name, however, I would like to know if there is any chance of sending the e-mail from my box but the "From" to appear another legend or e-mail.
2-Is there anyway to make this e-mail an HTML e-mail instead of plain text? I know here it appears that the verbiage comes from a table where I have stored the wording, however, could be an image as banner be added and those stuffs?
Thanks and regards!