Click here to Skip to main content
11,496,146 members (575 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
See more: C# ASP.NET
Not able to send email from godaddy server. Getting following error,
Mailbox name not allowed. The server response was: Sorry, that domain isn't in my list of allowed rcpthosts.

Here is my code snippet.

System.Net.Mail.SmtpClient Mail = new System.Net.Mail.SmtpClient();
        Mail.Host = "";
        Mail.Port = 3535;
        Mail.Timeout = 10000;
        string username = null;
        string Password = null;

        Mail.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
        username = txtUsername.Text.Trim();
        Password = txtPassword.Text.Trim();
        System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(username, Password);
        Mail.UseDefaultCredentials = false;
        Mail.Credentials = basicAuthenticationInfo;
        System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage();
        myMail.Subject = "Test Email";
        myMail.From = new System.Net.Mail.MailAddress(txtFrom.Text, txtFrom.Text);
        myMail.To.Add(new System.Net.Mail.MailAddress(txtTo.Text));

        myMail.IsBodyHtml = true;
        myMail.Body = "Test Email";

            lblmsg.Text = "Message send successfully.";
        catch (Exception ex)
            lblmsg.Text = ex.Message.ToString();

I have tried with port 25 and 3535 but same error is coming.
Posted 29-Mar-12 20:11pm
This is a server configuration, nothing a programmer can fix without access to the server. You're not allowed to relay through that server to the destination domain, and only the server admin can fix that for you.

Replace your code with this code And check weather it works fine or not.
I checked it and works fine from my side.

SmtpClient client = new SmtpClient("", 3535);
System.Net.NetworkCredential myCache = new System.Net.NetworkCredential("complete email id", "password");
client.Credentials = myCache;
// Specify the message content.
MailMessage message = new MailMessage(, "");
message.Body ="test";
message.Subject ="test";
Console.WriteLine("Sent email to: " + "");
catch (Exception ex)
Console.WriteLine("{0} Exception caught.", ex);
Mukund Thakker at 30-Mar-12 7:44am
This is what posted by Uday Singh. Please check my comments in Solution1
swapnilKumbhar at 2-Apr-12 11:56am
try this
1)check your connection setting once again
2)off the firewall then try
3)try to connect to other server
else show your code to expert.

hope you come out of this problem.
Try This[^]

hope it helps Smile | :)
Mukund Thakker at 30-Mar-12 2:06am
I have already checked this, gives following error,

Mailbox name not allowed. The server response was: Sorry, that domain isn't in my list of allowed rcpthosts.
SmtpClient ss = new SmtpClient();
               ss.Host = "";
                ss.Port = 25;
                ss.Timeout = 10000;
                ss.DeliveryMethod = SmtpDeliveryMethod.Network;
                ss.UseDefaultCredentials = false;
                ss.Credentials = new NetworkCredential("your_full_emailAddress", "YourPassword", "your_Domain");
                ss.EnableSsl = false;
                MailMessage mailMsg = new MailMessage("your_full_emailAddress", "", "subject here", "my body");
                mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                Response.Write("Mail Sent");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600

Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100