Error:

The server rejected one or more recipient addresses. The server response was: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server ..

Suppose the server's name is example.com It will allow you only to send email to xxx@example.com addresses. If you want to send email to @hotmail.com you need to have an account on the server, so you'll have to login with your email and password before being able to send. Is it your own server ? Then look in the manual, otherwise check your provider's support.

hi.. everyone.. the problem is solved..

Here is the Code..

private bool SendMail(string body, string subject)
    {
        
        MailMessage message = new MailMessage();
        message.To = "name@domain.com";
        message.From = "name@domain.com";
        message.Subject = "Subject";
        message.BodyFormat = MailFormat.Html;
        message.Body = "Testing Message";

        string Username = "Username"; 
        string Password = "Password";
        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.domainname.com";
        System.Web.Mail.SmtpMail.SmtpServer = SmptServer;
        System.Web.Mail.SmtpMail.Send(message);
        return true;
    }


    protected void Sendthemail()
    {
        bool y = SendMail(PanelToHtml(PanelMail), "Send Panel");
        if (y == true)
        {
            ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Msg", " alert('Current Mail has sent'); ", true);
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.