views:

81

answers:

1

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?

+1  A: 

When sending email from GoDaddy's web server, you should need to relay-hosting.secureserver.net.

SLaks
And see here for a somewhat older step-by-step guide for setting up (may be outdated but may help) http://rtur.net/blog/post/SMTP-with-GoDaddy.aspx
Eric J.
+1 SLaks. Fantastic, thank's very, very much. My site is now fully functional. <phew>
griegs