views:

559

answers:

4

So, I'm trying to send an smtp email from my website as a confirmation that their order has been place. The site is hosted on godaddy and I have no idea what's going on. I'm getting all kinds of error messages. The current one is:

"System.Net.Mail.SmtpException: Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)"

My code is:

    string body = "Your order was placed";
    MailMessage objEmail1 = new MailMessage("[email protected]", userEmail, "Confirmation Email", body);
    objEmail1.IsBodyHtml = true;
    SmtpClient client = new SmtpClient();
    client.Host = "relay-hosting.secureserver.net";
    client.UseDefaultCredentials = false;
    client.Send(objEmail1);

I think the problem lies in the from address not belonging to godaddy or with the client.Host. Ideas?

A: 

Programmatically your code is probably correct, your e-mail server just does not allow relaying. I.e. neither your sender or recipient address is "native" to the mail server.

Kimvais
A: 

Do you have the way, manner, or code to get the opcion to retrieving's user password from dotnetnuke "Forgot your password?" by "relay-hosting.secureserver.net" or "smtpout.secureserver.net" godaddy? I've tried every code found in internet and anything is working.

David
A: 

Following code should work for godaddy, found on another site...

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(toaddress); mail.From = "fromaddress"; mail.Subject = Subject; mail.Body = Body ; mail.IsBodyHtml = true ;

    Attachment attachment = new Attachment(fileName); 
mail.Attachments.Add(attachment);    //add the attachment            

    SmtpClient client = new SmtpClient();
    client.Credentials = new System.Net.NetworkCredential(username, pwd);
    client.Host = "godaddysmtpserver";
    try
    {
        client.Send(mail);
    }
    catch (Exception ex)
    {
    //the exception
    }
Gunjan Dhanuka