问题
I need to send an email in my C# project using my companies Exchange Server.
Because someone sent out thousands of Emails from my company using a self hosted server, any attempts to not use the company Exchange Server to send the email will be squished.
I imagine I am going to need to get an Active Directory user created to do this... but what code to use? How to do the sending?
回答1:
You can send email through Exchange using SMTP with .Net's SmtpClient class.
You will need a login for the server.
回答2:
You could use the System.Net.Mail classes to send the email via SMTP if that is enabled on your SMTP server. Alternatively you could use the webdav protocol to send the email via HttpRequests and HttpResponses. An example showing how to do this can be found here.
来源:https://stackoverflow.com/questions/5173530/send-an-email-using-exchange-server-only