Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7823053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:06:48+00:00 2026-06-02T08:06:48+00:00

I have written ASP.Net code to send mails from domain1.com mail account such as

  • 0

I have written ASP.Net code to send mails from domain1.com mail account such as abc@domain1.com. This code work fine otherwise and the mails go. But when the same code executes on domain2.com, even with correct userid-pwd it gives the following error:

System.Net.Mail.SmtpFailedRecipientException: Mailbox name not allowed. The server response was: sorry, that domain isn’t in my list of allowed rcpthosts (#5.7.1) at System.Net.Mail.SmtpClient.Send(MailMessage message)

Is there any way to fix this?

If we have to add this domain in the list of allowed rcphosts, how can that be done?

The code written is something like this:

MailMessage message;
bool success;
message = new MailMessage(from, to);
Attachment file;
SmtpClient lclient;


lclient = new SmtpClient("mail.domain1.com", 587);
lclient.EnableSsl = false;

message.Body = body;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
message.Subject = subject;
message.SubjectEncoding = System.Text.Encoding.UTF8;

lclient.SendCompleted += new 
SendCompletedEventHandler(SendCompletedCallback);
lclient.UseDefaultCredentials = false;
lclient.Credentials = new NetworkCredential(userID, password);
try
{

  lclient.Send(message);
  success = true;
  if (message != null)
      message.Dispose();
  success = true;
  return (success);
}
catch (Exception ex)
{  
    //...
}

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:06:50+00:00Added an answer on June 2, 2026 at 8:06 am

    The code works fine. The error is a rejection from the SMTP server. It would seem that the server, when accessed from Domain1, allows you to forward mail through it. When accessed from Domain2, it does not. Changing this would be a configuration on the SMTP server.

    Note that this is common practice for SMTP services. They generally don’t allow anybody to send mail through them to any address. (That would leave them wide open for spammers and other such unwanted activities.) So, if you’re trying to access Domain1’s SMTP service from outside of Domain1, it’s probably just rejecting that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in my ASP.NET application written in C# that is trying
I have written some code for saving an image to a folder in asp.net.
I have written the code in ASP.NET AJAX to authenticate and authorize the user.
I have some terribly written ASP.NET code that is just not working right (go
I have written the following asp.net code ,How to access the value of minvalue
I have written ASP.NET (4.0) code that sets the Response.StatusCode to 400 if the
I have ASP.Net web app and my c# code calls into a custom COM
Good Morning, I'm working on an ASP.NET 3.5 webforms application and have written the
I have a web page written in ASP.NET and I need to retrieve the
I have two sites one is written in asp.net webforms and the other one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.