the website I built needs to send email using a contact form. The hosting is godaddy shared windows hosting (plesk), email hosting is godaddy office365. I can send and receive email using the webmail office365. However when I try to send the email from the website, the emails are sent but not received. Website is ASP.NET MVC5 application and settings are (Send email using System.Net.Mail)
There is no error in this case and the email appears to be sent, but it is never received.
I have also tried with <network host="smtp.office365.com" port="587" userName="email@example.com" password="####" defaultCredentials="false" enableSsl="true" />
in this case there is an exception thrown: System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 188.8.131.52:587
I have also added this record to DNS v=spf1 mx a include:secureserver.net ~all