Mail Sending Problem  in asp.net Server Rejected Sender Address, Error Code 551

Posted on 2009-05-27
Medium Priority
Last Modified: 2013-11-07
am getting error while sending a mail ..
i have contact us form, i need to send a mail from any domain to a speciifed domain
like from address  may be yahoo, gmail or anything but the To address will be a single domail.

here is the code which i have used.. plz can any one help me..
public bool SendMail(Panel body, string subject, string from)
            MailMessage message = new MailMessage();
            message.To = "mail@mydomain.com";
            message.From = from;     // any domian.. 
            message.Subject = subject;
            message.BodyFormat = MailFormat.Html;
            message.Body = "<html><head></head><body width='550px'><div align='left' width='550px' style='font-family: Arial; font-size:x-small'>" + PanelToHtml(body) + "<br/></div></body></html>";
            string Username = "mail@mydomain.com";
            string Password = "mypassword";
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //none, cdoBasic, NTLM
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", Username);
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", Password);
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2); // cdoNTLM, value 2. The current process security context is used to authenticate with the service.
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", false);
            message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60);
            string SmptServer = "mail.domain.com";
            System.Web.Mail.SmtpMail.SmtpServer = SmptServer;
            return true;
        catch(Exception ex)
            throw ex;
    public string PanelToHtml(Panel PanelMail)
        StringBuilder sb = new StringBuilder();
        StringWriter sw = new StringWriter(sb);
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        return sb.ToString();

Open in new window

Question by:Rajeshk_cgm
1 Comment
LVL 19

Accepted Solution

Melih SARICA earned 1500 total points
ID: 24490175
U dont ave rely permission on server..

Ask ur mail admin to give u rely permission..

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The Exchange database may sometimes fail to mount owing to various technical reasons. A dismounted EDB file can be the source of many Exchange errors including mailbox inaccessibility for users. Resolving the root cause of mounting problems becomes …
This article explains how to move an Exchange 2013/2016 mailbox database and logs to a different drive.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …

597 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