SMTP Send Mail Error SendMailResult is Authenticate ?

May 9, 2014 at 4:09 PM
Edited May 9, 2014 at 4:09 PM
Hi All,

I am sorry but I am asking lots of questions again & again. But the developer who created this library I need your help..

Below are the steps which I am doing for sending an email. I am using Pop protocal
  1. FIRST : I am using "Pop3Client" object for Authenticating the email server I am initializing the Server Name, Port No, Username & Password.
  2. SECOND : After successfull Login into the email server I want to send email so I am using "SmtpClient" object and I am initializing the Server Name, Port No, Username & Password.
But the response which I am getting from the email server i SendMailResult State is Authenticate I don't know what thats mean exactly ?

Here is my code
                using (Pop3Client objPop3Client = new Pop3Client("xxx"))
                {
                    objPop3Client.ServerName = "xxx";
                    objPop3Client.Port = xxx;
                    objPop3Client.AuthenticateMode = Pop3AuthenticateMode.Pop;
                    objPop3Client.Ssl = true;

                    objPop3Client.UserName = "XXXt@XXX.XXX";
                    objPop3Client.Password = "XXXXX";

                     // Authenticating the Username and Password which is stored on the server
                    if (objPop3Client.Authenticate())
                    {
                        SmtpMessage mg = new SmtpMessage();
                        mg.Subject = "title";
                        mg.BodyText = "Hi.my mail body text!";
                        //Send by HTML format
                        mg.IsHtml = true;
                        MailAddress objmailAdress = new MailAddress("faxtest@iqbackoffice.com");
                        mg.From = objmailAdress;
                        mg.To.Add(new MailAddress("XXX"));

                        using (var objSmtpclient = new SmtpClient("XXX"))
                        {
                            objSmtpclient.ServerName = "XXX";
                            objSmtpclient.Port = 465;
                            objSmtpclient.EncryptedCommunication = SmtpEncryptedCommunication.Ssl;

                            SendMailResult objSendMailResult = objSmtpclient.SendMail(mg);

                            if (objSendMailResult.SendSuccessful == false)
                            {
                                //You can get information about send mail is success or error reason
                                var resultState = objSendMailResult.State;
                                //Do something. ex)show a complete message
                            }
                        }
                    }
                }
Coordinator
May 9, 2014 at 4:37 PM
Edited May 9, 2014 at 5:15 PM
SendMailResult State is Authenticate
That means you fail authenticate to smtp server.
Your code looks that you don't set UserName,Password of SmtpClient object (not Pop3Client object).
Please try to set other value of SmtpClient object or server settings about username or password or ensure port is opened.

regards.
Marked as answer by rickjackson on 5/16/2014 at 12:41 AM
May 11, 2014 at 7:20 AM
I solved my issue with your help... Thanks again