Sending Email from ADP using CDO
Been trying to send e-mail using CDO 1.2.1 from my Access ADP project as I want to bypass MS Outlook. However, I am facing some AccessDenied error...
The error message is as stated:
[Collaboration Data Objects - [E_ACCESSDENIED(80070005)]]
Stepping through my code, the error is generated at the .Send Statement (see code below).
Any help is greatly appreciated. Thanks in advance.
Below is my code:
Private Sub CmdSendEmail_Click()
Dim cdoSession As MAPI.Session
Dim cdoFolder As MAPI.Folder
Dim cdomessages As MAPI.Messages
Dim cdomessage As MAPI.Message
Dim cdoRecipient As MAPI.Recipient
Dim cdoRecipients As MAPI.Recipients
Set cdoSession = New MAPI.Session
Set cdoFolder = cdoSession.Outbox
Set cdomessages = cdoFolder.Messages
Set cdomessage = cdomessages.Add
Set cdoRecipients = cdomessage.Recipients
.Text = Me!txtMessage
.Subject = "Issue Resolution"
Set cdoRecipient = cdoRecipients.Add
cdoRecipient.Name = "Scripts"
cdoRecipient.Type = CdoTo
cdoRecipient.Address = "SMTP:myMail@myMail.com"
.Update '<- No problem here.
.Send '<- This is where the error is generated
Set cdoSession = Nothing