问题
According to this answer it is possible to configure IIS to receive email. That is what I would like to do. But the answer says it's done under IIS SMTP under domains.
I connected to my website (on a web host) using IIS Manager and the only SMTP option I see is SMTP E-mail under the ASP.NET heading. (I have one more heading which is IIS, but doesn't have any SMTP under it.)
Clicking on SMTP E-mail shows me an option to "Use this feature...when sending e-mail...". and it has a textbox for E-mail address and radio buttons to choose from Deliver e-mail to SMTP server and Store e-mail in pickup directory.
I don't see any option for allowing it to receive emails.
So where is the option to receive emails?
(If you have a different way to receive emails without any action taken on them, I'd be glad to hear about it. I want to process the email regardless of the address it's being sent to as long as it's to my domain.)
回答1:
You need the IIS 6 manager for that - even if you have IIS 7-8-9-10 installed. The SMTP part is still only in IIS 6 :(
It's not problem to run them side-by-side and you will use IIS 6 manager only for SMTP
With this option you could send and receive emails.
The IIS 6 manager looks like this:
And with you Windows system you need to install the SMTP server:
which give you IIS 6 (SMTP only)
See also https://www.interserver.net/tips/kb/how-to-setup-and-configure-smtp-server-on-windows-server-2008-r2/
And http://www.vsysad.com/2017/05/install-and-configure-smtp-server-on-windows-server-2016/
and see also How to configure SMTP in IIS 7?
回答2:
I have a scenario where I wanted my web application to accept inbound emails and process them. I didn't find the SMTP server that comes with IIS to be helpful.
What ended up being a much better solution for receiving mail messages for me was to use an inbound email parsing service. You configure a domain's MX record to point to their (parsing service provider) mail server and their mail server parses the message and Posts to a page on your web server. My ASP.Net MVC Controller Action looks like this:
public ActionResult InboundMessage(FormCollection collection, HttpPostedFileBase attachment1, string attachments, string to, string from)
They get the email and call my code. I don't have to worry about any of the SMTP details. I've been using this for several years and it's worked great for me.
I'm not sure how recommending a specific product goes over around here, but if you Google "inbound email parser", you'll find several options.
If you want to go the original route, it is possible to receive inbound mail. It will write incoming messages to the "Drop" folder. (If you Google "IIS SMTP Drop folder", you will find information about how to do this.)
Before I found the Inbound Parse service, I ended up cobbling my own mail server together from some code on found on GitHub, but even then, parsing the parts of a message was a much bigger undertaking than I was expecting.
来源:https://stackoverflow.com/questions/56621895/configure-iis-to-receive-email