cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New

Problem sending form emails from website ASP.NET

Hello,

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)

<system.net>
  <mailSettings>
    <smtp from="info@domain.com">
      <network host="relay-hosting.secureserver.net" port="25" />
    </smtp>
  </mailSettings>
</system.net>

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="name@domain.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 40.101.12.2:587

I have also added this record to DNS
v=spf1 mx a include:secureserver.net ~all

as suggested by Contact-Form-not-sending-email-to-Office-365-emai

 

I would appreciate any help. What should I do to make this work?

0 REPLIES 0