2

要求非常基本,将电子邮件发送到 Exchange 分发列表。

代码是:

    public void SendMessage(
        string from, string to, string cc, string bcc, string subject)
    {
        string hostName = "localhost";
        var message = new System.Net.Mail.MailMessage();
        message.From = new MailAddress(from); 
        message.CC.Add(cc);
        message.To.Add(to); //to is the email address of distribution list
        message.Subject = subject;
        message.Bcc.Add(bcc);

        var smtpClient = new SmtpClient(hostName);
        smtpClient.Credentials = CredentialCache.DefaultNetworkCredentials;
        try
        {
            smtpClient.Send(message);
        }
        catch (Exception e)
        {
            _loggingService.LogException(e, _applicationContextService.CurrentUsername);
        }
    }

这里的“to”是分发列表的电子邮件地址。

程序向 CC 和 BCC 发送电子邮件,但无法向分发列表的成员发送电子邮件。我已经为https://serverfault.com/a/24805中解释的分发列表禁用了“要求所有发件人都经过身份验证” 。但是仍然没有将电子邮件发送到分发列表。

有什么帮助吗?谢谢。

4

0 回答 0