使用lotuslive凭据从C#代码发送邮件?

时间:2011-11-28 05:47:52

标签: c# smtp sendmail lotus

我正在尝试使用lotuslive smtp从C#代码发送邮件。但我没有成功发送邮件。每当它说 {"无法从传输连接读取数据时:远程主机强行关闭现有连接。"}

我的代码适用于其他电子邮件主机,例如gmail和yahoo。

下面是我使用过的代码。

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)
            {

            }

1 个答案:

答案 0 :(得分:0)

  

传出SSL SMTP服务器:-smtp.mail.lotuslive.com(端口:465)请   注意:第三方电子邮件客户端的传出SMTP访问不是   可用于试用帐户。

如果是跟踪帐户,则可能会导致一些问题。

    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;

如果您没有模拟账户,请选中此链接 - How to configure client in Outlook 2003 检查这些outlook configure settings匹配您的代码设置。

如果所有这些内容都不是问题,那么您的邮件服务器可能会出现问题。查看这些链接以获取信息: An existing connection was forcibly closed by the remote host in SMTP client
System.Net.Mail with SSL to authenticate against port 465