SMTP is a whole new ballgame for me, but I am reading up on it.
I am attempting to send email from my
EC2 instance using GoDaddy's SMTP server. My domain name is registered through GoDaddy and I have 2 email accounts with them.
I can successfully send the email from my dev box no problem.
my web.config
<system.net>
<mailSettings>
<smtp from="
[email protected]" deliveryMethod="Network">
<network host="smtpout.secureserver.net" clientDomain="mydomain.com" port="25" userName="
[email protected]" password="mypassword" defaultCredentials="false" />
</smtp>
</mailSettings>
</system.net>
In my ASP.NET app:
MailMessage mailMessage = new MailMessage("
[email protected]", recipientEmail, emailSubject, body);
mailMessage.IsBodyHtml = false;
SmtpClient mailClient = new SmtpClient();
mailClient.Send(mailMessage);
Very typical, simple use of System.Net.Mail.SmtpClient. The mail client is picking up the settings from my web.config as expected.
From the
EC2 instance, the same setup yields:
System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.
at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine)
at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
I have searched high and low and not found anyone else attempting this. All GoDaddy smtp situations I have found involve people being hosted by GoDaddy using their relay server.
Some more info:
My
EC2 instance is Windows Server 2008 with IIS 7. The app is running in .NET 4
I can successfully use Gmail's SMTP server on the
EC2 instance by using their port, setting SmtpClient.EnableSsl to true, and sending the mail through a gmail account. But we want to send the email from an account on our domain.
I have port 25 open on both the Windows firewall and Amazon's Security group based firewall.
I have played with Wireshark and noticed my SMTP related traffic was talking to ports in the 5,000s, so out of desperation I opened them all up to no avail (then closed them back down)
As far as I know my
EC2 instance's IP address is not black listed by GoDaddy.
I have a feeling I'm just missing something fundamental. I also have a feeling someone is going to recommend I use AuthSmtp or something similar, I'll agree, and have had wasted the past 6 hours :)