Mail Sent

  • My Code:

    string LoginId = "seetha@xxx.com";

    string Password = "uu";

    //string Attachments = "D:\\Seetha\\Projects\\EmdForum\\Forum\\MyFiles\\APP.txt";

    string Attachments = string.Empty;

    SmtpClient smtp = new SmtpClient("smtp.bizmail.yahoo.com");

    //SmtpClient smtp = new SmtpClient("smtp.gmail.com");

    smtp.UseDefaultCredentials = false;

    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

    smtp.Port = 465;

    smtp.EnableSsl = true;

    smtp.Credentials = new System.Net.NetworkCredential("support@xxx.com", "support");

    MailMessage mail = new MailMessage();

    mail.To.Add(LoginId);

    mail.Subject = Password;

    mail.Body = "LoginId" + ":" + LoginId + " " + "Password " + ":" + Password;

    mail.BodyEncoding = System.Text.Encoding.UTF8;

    mail.SubjectEncoding = System.Text.Encoding.UTF8;

    mail.From = new MailAddress("support@xxx.com", "support", System.Text.Encoding.UTF8);

    mail.IsBodyHtml = true;

    mail.Priority = MailPriority.High;

    if (Attachments != string.Empty)

    {

    Attachment attach = new Attachment(Attachments);

    mail.Attachments.Add(attach);

    }

    try

    {

    smtp.Send(mail);

    string Scriptalert = "alert(' Successfully send');";

    ScriptManager.RegisterStartupScript(this, GetType(), "", Scriptalert, true);

    }

    catch (Exception mailEx) { throw mailEx; }

    I got this error

    [Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]

    How to Recover?

    Note:

    If Use Gmail Id the mail Successfully send

  • Are you sure the outgoing port is correct and your credentials are right? The various mail hosting companies can be strict about sending mail.

  • I felt that smtp mail is kind of tricky sometimes since

    different web hosting vendors use different mail policies...

    http://webbeyond.blogspot.com/2011/09/send-email-in-aspnet-from-arvixe-web.html

    http://webbeyond.blogspot.com/2011/11/godaddy-email-error-553-sorry-your-mail.html

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply