简体   繁体   English

这是我使用 Exchange Server 的服务发送 email 的代码

[英]This is the code I use to send an email using the service of Exchange Server

    public void ReplyMessage(string subject, string body, string to)
    {
        EmailMessage message = new EmailMessage(service);
        message.Subject = "re: " + subject;
        message.Body = body;
        message.ToRecipients.Add(to);
        message.SendAndSaveCopy();
    }

My question is will it also send to gmail or hotmail emails?我的问题是它还会发送到 gmail 或 hotmail 电子邮件吗?

That completely depends on the setup of your mail server, it is generally common practice that either the from or to address needs to be a domain serviced by the mail server.这完全取决于您的邮件服务器的设置,通常的做法是,发件人或收件人地址需要是邮件服务器服务的域。 So if your mail server is mymail.com, as long as its from me@mymail.com it would be able to send to gmail/yahoo/hotmail - assuming you havent managed to get on one of the black lists.因此,如果您的邮件服务器是 mymail.com,只要它来自 me@mymail.com,它就可以发送到 gmail/yahoo/hotmail - 假设您没有设法进入黑名单之一。 Similarly, if you send it to yourself from an external address that will probably work fine too.同样,如果您从外部地址将其发送给自己,也可能会正常工作。

However, open relaying (eg sending in my example from say me@gmail.com to me@hotmail.com) will normally fail because the server would end up abused and end up on black lists and often then block proper mail too.但是,开放式中继(例如,在我的示例中从 me@gmail.com 发送到 me@hotmail.com)通常会失败,因为服务器最终会被滥用并最终进入黑名单,然后通常也会阻止正确的邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法以编程方式使用MS Exchange Server 2010 SP2的Web服务发送电子邮件 - Can not programmatically send email using web service of MS Exchange Server 2010 SP2 使用包含主体的URL的Exchange Web服务器发送电子邮件 - send email using exchange web server with body contains URL 如何在不使用smtp的情况下通过Exchange服务器发送电子邮件? - How to send email via exchange server without using smtp? 如何使用WebDAV代码解析Exchange Server 2003的电子邮件地址 - How to resolve the email address of Exchange Server 2003 using WebDAV code 如何通过电子邮件在交换服务器上发送.zip附件? - How to send .zip in attachment by email on exchange server? 从模板(.oft 文件)发送 email - 使用 C# 的交换服务 - Send email from template (.oft file) - Exchange Service using C# 如何使用 c# 向 Exchange 分发列表发送电子邮件 - How do I send an email to an Exchange Distribution list using c# c#通过Exchange Server 2010发送电子邮件 - c# Send Email through Exchange server 2010 ASP.NET Exchange Server发送电子邮件C# - ASP.NET Exchange Server Send Email C# 如何为请求的Exchange Server版本Exchange2007_SP1发送带内嵌附件的ews电子邮件 - How to send ews email with inline attachments for requested exchange Server Version Exchange2007_SP1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM