Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SmtpServer error

Posted on 2010-09-13
4
Medium Priority
?
606 Views
Last Modified: 2013-12-16
Hi all
I can't seem to trace what is causing the SmtpServer to respond : " Mailbox unavailable. The server response was: sorry, no mailbox here by that name (#5.1.1) "

Stack Trace:

[SmtpFailedRecipientException: Mailbox unavailable. The server response was: sorry, no mailbox here by that name (#5.1.1)]
   System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +1078355
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1480
   prsnj.ReportSales.Submit_Click(Object sender, EventArgs e) +1349
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

I have also attached the code that sends the mail
Many thanks
MailDefinition md = new MailDefinition();
            string ReceipientAdddresss; 
            md.From = "form@mount.com";

            md.IsBodyHtml = true;
            md.Subject = "Report Repairs from " + your_name.Text;

            //Get Managers email
            ReceipientAdddresss = prsnj.bll.portfolio.GetManagersEmail(Convert.ToInt16(properties.SelectedItem.Value));

                ListDictionary replacements = new ListDictionary();
            replacements.Add("<%date%>", ReportDate.Text);
            replacements.Add("<%tenant_name%>", tenant_name.Text);
            replacements.Add("<%your_name%>", your_name.Text);
            replacements.Add("<%property%>", properties.SelectedItem.Text);

            if (SubDivision.Items.Count != 0)
                replacements.Add("<%SubDivision%>", SubDivision.SelectedItem.Text);
            else
                replacements.Add("<%SubDivision%>", "None");

            replacements.Add("<%email%>", email.Text);
            replacements.Add("<%phone%>", phone.Text);
            replacements.Add("<%repair_type%>", repair_type.SelectedItem.Value.ToString());
            replacements.Add("<%description%>", description.Text);


            string body = "<html><body>" +
                "<table class=\"form\" cellspacing=\"0\" border=\"0\" align=\"center\">" +
                    "<tr>" +
                         "<th align=\"left\"><strong>Date </strong>:</th> <td><%date%></td>" +
                    "</tr><tr>" +
                         "<th align=\"left\"><strong>Tenant Name</strong>:</th> <td><%tenant_name%></td>" +
                    "</tr><tr>" +
                         "<th align=\"left\"><strong>Your Name</strong>:</th> <td><%your_name%></td>" +
                    "</tr><tr>" +
                          "<th align=\"left\"><strong>Property</strong>:</th> <td><%property%></td>" +
                     "</tr><tr>" +
                          "<th align=\"left\"><strong>SubDivision</strong>:</th> <td><%SubDivision%></td>" +
                    "</tr><tr>" +
                           "<th align=\"left\"><strong>Email</strong>:</th> <td><a href=\"mailto:<%email%>\"><%email%></a></td>" +
                    "</tr><tr>" +
                            "<th align=\"left\"><strong>Phone</strong>:</th> <td><%phone%></td>" +
                    "</tr><tr>" +
                            "<th align=\"left\"><strong>Repair Type</strong>:</th> <td><%repair_type%></td>" +
                    "</tr></table>" +
                "<p><strong>Description</strong>: <%description%></p>" +
                "</body></html>";


            MailMessage msg = md.CreateMailMessage(ReceipientAdddresss, replacements,
                body, new System.Web.UI.Control()); 

            
           

            msg.Priority = MailPriority.Normal;

            SmtpClient mSmtpClient = new SmtpClient(ConfigurationManager.AppSettings["SmtpServer"]); //Set smtp in web.config file

  
            
            mSmtpClient.Send(msg);

            Status.Text = SuccessMsg;

Open in new window

0
Comment
Question by:simshp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
SriVaddadi earned 2000 total points
ID: 33667218
Your smtp server might require authentication and It does not seem you have set the credentials using  Credentials property. Set the valid credentials and try.
0
 
LVL 13

Expert Comment

by:game-master
ID: 33670134


make sure SMTP server really exist on the value that you have on the web.config
0
 
LVL 16

Expert Comment

by:13598
ID: 33672429
What value do you get for ReceipientAdddresss =>
MailMessage msg = md.CreateMailMessage(ReceipientAdddresss, replacements,  
                body, new System.Web.UI.Control());  
 
Here is the description of your error:

SMTP Error 511 : Bad email address. This error is
similar to error 510 and as with error 510, this status code
is generated by the sender’s local mail server.
If the email was addressed internally, then it means that
the addressee, as written in the email’s TO, CC, or BCC
fields, does not exist in your organization’s email system.
0
 

Author Comment

by:simshp
ID: 33817108
Thanks for all the input .. but the 1st soln did the trick
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
There was an incident about the POP3 issue for the double read receipts and delivery receipts in Exchange 2013.  There was huge research been done and found solution for the duplicate mails. Especially when the user gets  duplicate mails.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question