Send Email Via GoDaddy
Posted
by griegs
on Stack Overflow
See other posts from Stack Overflow
or by griegs
Published on 2010-05-31T00:33:46Z
Indexed on
2010/05/31
0:42 UTC
Read the original article
Hit count: 877
I know this question has been done to death but none that I've found here answer the question.
I have the following code in my controller;
SmtpClient smtpClient = new SmtpClient();
try
{
smtpClient.Host = "smtpout.secureserver.net";
smtpClient.Port = 25;
smtpClient.Timeout = 10000;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new NetworkCredential("[email protected]", "EmailPassword");
String bodyText = fvm.ContactNumber + "\n" + fvm.EmailAddress + "\n" + fvm.FirstName + " " + fvm.LastName + "\n" + fvm.Comments;
MailMessage mailMessage = new MailMessage("[email protected]", "[email protected]", fvm.Reason, bodyText);
mailMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
smtpClient.Send(mailMessage);
}
catch(Exception ex) { }
This code works great in dev on my local box but won't send when published on the GoDaddy server.
Does anyone know how to send Email from GoDaddy?
© Stack Overflow or respective owner