3
Answers

Throws Email smtp error in server(FTP)..

Hema Latha

Hema Latha

9y
542
1
Hi,

I am implementing an email system in my application. It is working fine in local system but when i am moving to server (FTP) it throws an error shown in the below figure.

The client server system is from US.






Here is the code for email system i am writing.

                    StringBuilder sb = new StringBuilder();
                    string id1 = res1.ToList()[0].gid;
                   
                    sb.AppendLine(txtbody.Text);
                    string str = sb.ToString();
                    MailMessage mail = new MailMessage();
                    mail.To.Add("[email protected]");
                    if (txtccaddress.Text != "")
                    {
                        mail.To.Add(txtccaddress.Text);
                    }
                    if (txtbcc.Text != "")
                    {
                        mail.To.Add(txtbcc.Text);
                    }
                    mail.From = new MailAddress("[email protected]");
                    mail.Subject = "New Guarantor Account Details";
                    string Body = "New Guarantor Account Details:" + "<br>";
                    Body += "Guarantor Email Address  " + " : " + user + "<br>";
                    Body += "Guarantor gid" + " : " + id1 + "<br/>" + "<br/>";
                    if (txtccaddress.Text != "")
                    {
                        Body += "CC" + " : " + txtccaddress.Text;
                    }
                    Body += sb;
                    mail.Body = Body;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = "smtp.gmail.com";
                    smtp.Port = 587;
                    mail.IsBodyHtml = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials = new                         System.Net.NetworkCredential("[email protected]", "bisteam123 ");
                    smtp.EnableSsl = true;
                    smtp.Send(mail);


Please Help me..It's urgent..

Thanks in advance....
Answers (3)