0

I am trying to send mail from C# code using lotuslive smtp. But I have no success in sending the mail. everytime it says {"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."}.

My code is working fine for other email hosts like gmail and yahoo.

below is the code that I have used.

MailMessage message = new MailMessage();
    message.From = new MailAddress("fromaddress");
    message.To.Add(new MailAddress("toaddress"));

    message.Subject = "Test";
    message.Body = "test";

    SmtpClient client = new SmtpClient("companyname-com-smtp.mail.lotuslive.com", 465);
    client.UseDefaultCredentials = false;

    NetworkCredential credential = new NetworkCredential("companycredentials", "password");

    client.Credentials = credential;


    client.EnableSsl = true;
           try
            {
                client.Send(message);
            }
            catch(Exception ex)
            {

            }
Sumit
  • 2,932
  • 6
  • 32
  • 54

1 Answers1

0

Outgoing SSL SMTP Server: -smtp.mail.lotuslive.com (port: 465) Please Note: Outgoing SMTP access for third party email clients is not available for Trial accounts.

If it is trail account then may cause some problems.

    MailClient = new SmtpClient();
    MailClient.Host = "smtp.mail.lotuslive.com/your host address";
    MailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
    MailClient.Credentials = new System.Net.NetworkCredential(username, password);
    MailClient.EnableSsl = true;
    MailClient.Port = 465;

If you do not have demo account then Check this link - How to configure client in Outlook 2003.
Check these outlook configure settings match to your code settings.

If all this stuff is not the issue then it may be problem at your mail server. Check these links for information: An existing connection was forcibly closed by the remote host in SMTP client
System.Net.Mail with SSL to authenticate against port 465

Community
  • 1
  • 1
Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75
  • Thanks Niranjan, I had already tried all that links before. Though the actual solution that I got was from below link http://stackoverflow.com/questions/1082216/gmail-smtp-via-c-sharp-net-errors-on-all-ports/3845907#3845907 – Sumit Nov 28 '11 at 09:02
  • So is the problem solved for you? If not, are you using a test account? – leyrer Nov 28 '11 at 16:27