bfuchs
asked on
Function to send email fails.
Hi Experts,
We have the following function that used to work for years, now suddenly its starting to cause problems.
See attached error message.
Untitled.png
We have the following function that used to work for years, now suddenly its starting to cause problems.
Public Sub SendEmail(Optional sTo As String = "", Optional sFrom As String = "", Optional sSubject As String = "", Optional sBody As String = "")
Dim imsg As Object
Dim iconf As Object
Dim flds As Object
Dim schema As String
Set imsg = CreateObject("CDO.Message")
Set iconf = CreateObject("CDO.Configuration")
Set flds = iconf.Fields
' send one copy with SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
flds.Item(schema & "sendusing") = cdoSendUsingPort
flds.Item(schema & "smtpserver") = "smtpout.secureserver.net."
flds.Item(schema & "smtpserverport") = 3535
flds.Item(schema & "smtpauthenticate") = cdoBasic
flds.Item(schema & "sendusername") = "MyEmail@MyDomain.net"
flds.Item(schema & "sendpassword") = "MyPWD"
flds.Item(schema & "smtpusessl") = False
flds.Update
With imsg
.To = sTo
.From = sFrom
.Subject = sSubject
.HTMLBody = sBody
'.Sender = "Sender"
'.Organization = "My Company"
'.ReplyTo = "address@mycompany.com"
Set .Configuration = iconf
.send
End With
Set iconf = Nothing
Set imsg = Nothing
Set flds = Nothing
End Sub
See attached error message.
Untitled.png
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Experts,
Wondering what needs to be changed in order to work.
https://community.smartbear.com/t5/TestComplete-Desktop-Testing/sending-mail-via-CDO-and-office365-com/td-p/132282
BTW, I'm open for other suggestions, not bounded to CDO (as long as they work and easy to apply/maintain..).
Thanks,
Ben
Have you changed something in the email configuration ..e.g version of Exchange serverYeah, guess this was working till now while our GoDaddy account was still active...
Wondering what needs to be changed in order to work.
Exchange 2016 doen't work with CDO.I see from the following it should work.
https://community.smartbear.com/t5/TestComplete-Desktop-Testing/sending-mail-via-CDO-and-office365-com/td-p/132282
BTW, I'm open for other suggestions, not bounded to CDO (as long as they work and easy to apply/maintain..).
Thanks,
Ben
Since you mentioned Go Daddy, are you using hosted Exchange or on-site?
ASKER
Since you mentioned Go DaddyOh forgot to mention..We changed for Office 365.
Thanks,
Ben
If you changed to Office 365 then it is probably because email relaying is not configured. Please have a look at these articles:
https://support.office.com/en-us/article/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-365-69f58e99-c550-4274-ad18-c805d654b4c4?ui=en-US&rs=en-US&ad=US#option1
http://office365support.ca/smtp-relay-with-office-365/
It's best to call Office 365 support and they should help you with this.
https://support.office.com/en-us/article/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-office-365-69f58e99-c550-4274-ad18-c805d654b4c4?ui=en-US&rs=en-US&ad=US#option1
http://office365support.ca/smtp-relay-with-office-365/
It's best to call Office 365 support and they should help you with this.
ASKER
I changed for the following
Went online to enlist the IP and it worked.
but after testing 2 times I'm getting the attached msg again..
What are my options?
Thanks,
Ben
Untitled.png
flds.Item(schema & "smtpserver") = "whiteglovecare-net.mail.protection.outlook.com"
flds.Item(schema & "smtpserverport") = 25
' flds.Item(schema & "smtpauthenticate") = 0
Then we got the attached.Went online to enlist the IP and it worked.
but after testing 2 times I'm getting the attached msg again..
What are my options?
Thanks,
Ben
Untitled.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you my experts!
You're welcome and glad to help. Cheers!
1. Local firewall is blocking it
2. Relaying is disabled. Can you verify with the email administrator that relaying is allowed?
3. Email server firewall is blocking it