简体   繁体   中英

.NET mail server for receiving emails

I want to be able to receive emails in our .NET project, but how can I do that? I see a lot of tutorials on how to send emails and extract them from an existing server with POP3, but I want to be able to process all mail incoming on our domain example.com, so that I can programmatically create accounts for users.

What I want is:

  • Dynamically create a temporary email for a user like: alias#12345@example.com, where "alias" is the user's alias and "12345" is a unique number, which we can use to look up in our database for assicaited values.
  • Have all email sent to the domain sent to our server, so that we can parse the address ourselves and handle the email.
  • Forward the emails to the user's private addresses
  • Allow the users to subscribe to their emails through IMAP or POP3.

If anyone could point me in the direction of a tutorial or recommend packages or services that would ease the process, that would be much appreciated. Also, if there would be a 3rd party service that still allows us to receive every email and hande what happens to them, that would also be interesting.

We already use Azure for hosting and SendGrid for sending emails.

I can give you a starter for 10 on this.

You should take a look at the inbound parse documentation: https://sendgrid.com/docs/ui/account-and-settings/inbound-parse/ This allows you to redirect the MX record to Sendgrid and allow it to POST the content to a specified URL.

ANY email will be sent there, so even ones with guid@domain.com will be sent there. You can then slice and dice as needed.

In the spirit of full disclosure, we have it working up to the point of getting the attachments (text/html/email addresses are all picked up) and sent to the DB. We send to a webform which chops up the request, but are currently trying to get StrongGrid working (nuget).

Hope this helps!

Peter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM