Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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.

C#
System.Net.Mail.SmtpClient Mail = new System.Net.Mail.SmtpClient();

        Mail.Host = "smtpout.secureserver.net";
        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";


        try
        {
            Mail.Send(myMail);
            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

 
Share this answer
 
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.



try
{
SmtpClient client = new SmtpClient("smtpout.secureserver.net", 3535);
System.Net.NetworkCredential myCache = new System.Net.NetworkCredential("complete email id", "password");
client.Credentials = myCache;
// Specify the message content.
MailMessage message = new MailMessage(pankaj@idjo.org, "pankaj@idjo.org");
message.Body ="test";
message.Subject ="test";
client.Send(message);
message.Dispose();
Console.WriteLine("Sent email to: " + "pankaj@idjo.org");
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
 
Share this answer
 
Comments
Mukund Thakker 30-Mar-12 7:44am    
This is what posted by Uday Singh. Please check my comments in Solution1
swapnilKumbhar 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 :)
 
Share this answer
 
Comments
Mukund Thakker 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 = "relay-hosting.secureserver.net";
                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", "demo@gmail.com", "subject here", "my body");
                mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
                ss.Send(mailMsg);
 
                Response.Write("Mail Sent");
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900