Where have I gone wrong please?
My code (below) gives Run-Time error
"The server rejected the sender address the response was 530.5.5.1"
gmail's answer is at https://support.google.com/mail/answer/14257
- but I don't understand what I am being asked to do.
I have tried changing SmtcServerPort (from 25 to 465 or 587)
Allow Less secure Apps in gmail is set Allow
I am certain all email addresses and password are correct (although I've not shown them in the code)
Any help would be much apreciated.
The code I have is:
Sub SendEmailByGmail()
Dim MyMail As CDO.Message
Set MyMail = New CDO.Message
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smptauthenticate") = 1
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmailAddress@gmail.com"
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "********"
MyMail.Configuration.Fields.Update
With MyMail
.Subject = "test"
.From = "MyEmailAddr@gmail.com"
.To = "MyEmailAddr@MyWebsite.co.uk"
.CC = ""
.BCC=""
.TextBody = "Test body"
End With
MyMail.Send
Set MyMail = Nothing
End Sub
Thank you in advance.
My code (below) gives Run-Time error
"The server rejected the sender address the response was 530.5.5.1"
gmail's answer is at https://support.google.com/mail/answer/14257
- but I don't understand what I am being asked to do.
I have tried changing SmtcServerPort (from 25 to 465 or 587)
Allow Less secure Apps in gmail is set Allow
I am certain all email addresses and password are correct (although I've not shown them in the code)
Any help would be much apreciated.
The code I have is:
Sub SendEmailByGmail()
Dim MyMail As CDO.Message
Set MyMail = New CDO.Message
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smptauthenticate") = 1
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "MyEmailAddress@gmail.com"
MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "********"
MyMail.Configuration.Fields.Update
With MyMail
.Subject = "test"
.From = "MyEmailAddr@gmail.com"
.To = "MyEmailAddr@MyWebsite.co.uk"
.CC = ""
.BCC=""
.TextBody = "Test body"
End With
MyMail.Send
Set MyMail = Nothing
End Sub
Thank you in advance.