如何创建电子邮件发送服务?

时间:2022-08-21 18:18:29

I've been kicking around this idea for a while and would like to read your thoughts.

我一直在讨论这个想法,并希望阅读你的想法。

I'd like to create a .NET service to send and track email messages.

我想创建一个.NET服务来发送和跟踪电子邮件。

My rough ideas:

我粗略的想法:

  1. Within various applications, serialize instances of .NET email (System.Net.Mail.MailMessage) objects and put them into a database or file system queue

    在各种应用程序中,序列化.NET电子邮件(System.Net.Mail.MailMessage)对象的实例并将它们放入数据库或文件系统队列中

  2. The mail service/process polls the queue and sends the emails

    邮件服务/进程轮询队列并发送电子邮件

  3. Enforce subscribe/unsubscribe lists/rules

    实施订阅/取消订阅列表/规则

  4. Track opens, bounces, out-of-office auto-replies, etc.

    跟踪打开,退回,外出自动回复等。

  5. Report statuses back to the original applications

    将状态报告回原始应用程序

Does anyone have advice for how I should get started or what issues I may have? Is there off-the-shelf software/service I should look at?

有没有人建议我应该如何开始或我可能有什么问题?我应该看一下现成的软件/服务吗?

3 个解决方案

#1


4  

You will need to learn everything you can about the SMTP protocol, even if you are using higher level tools that do most of the work for you. In my own experience with processing outbound and inbound emails with .NET, I didn't really "get it" until I learned to telnet to port 25 of an SMTP server and send en email by issuing the commands myself.

您将需要了解有关SMTP协议的所有信息,即使您使用的是可以为您完成大部分工作的更高级别的工具。根据我自己使用.NET处理出站和入站电子邮件的经验,在我学会telnet到SMTP服务器的端口25并通过自己发出命令发送电子邮件之前,我并没有真正“得到它”。

If you are sending lots of emails out and you need to monitor NDRs (non-deliverable reports), you will have to set the SMTP envelope sender address to your own server and parse all of those emails when they come in to figure out what happened.

如果您要发送大量电子邮件并且需要监控NDR(无法交付的报告),则必须将SMTP信封发件人地址设置为您自己的服务器,并在他们进入时解析所有这些电子邮件以找出发生的情况。

The System.Net email classes don't allow you to set the MAIL FROM in the conversation with the MTA without also setting the From address in the email header to the same thing, so you will need to use a 3rd party library like aspNetEmail if you need those addresses to be different.

System.Net电子邮件类不允许您在与MTA的对话中设置MAIL FROM,而无需将电子邮件标题中的发件人地址设置为相同的内容,因此您需要使用第三方库,如aspNetEmail你需要那些地址不同。

ListNanny is another tool that is helpful to parse NDRs, among other functions.

ListNanny是另一个有助于解析NDR以及其他功能的工具。

I'm not sure about serializing the MailMessage objects. I think it would be simpler to just store the separate data elements themselves and then instantiate MailMessage objects when you need them.

我不确定序列化MailMessage对象。我认为单独存储单独的数据元素然后在需要时实例化MailMessage对象会更简单。

#2


1  

You may find some of the answers to Handling undelivered emails in webapp useful.

您可以在webapp中找到处理未传递电子邮件的一些答案。

#3


1  

I suggest you seriously consider outsourcing your email services. I've looked into building a service like this for my webapps as well, but there are many things you will have to keep on top of that will take your time away from your primary webapp (unless of course, you are making this service your primary offering). Third party services take the headache and ongoing maintenance out of the picture.

我建议你认真考虑外包你的电子邮件服务。我也考虑过为我的webapps构建这样的服务,但是你需要保留很多东西,这将花费你的时间远离你的主要webapp(除非你正在使这个服务成为你的服务)主要提供)。第三方服务将头痛和持续维护排除在外。

If you go this route, you will need to regularly monitor your server reputation, maintain whitelist relationships with the big ISPs, monitor and handle bounces, set up correct message throttling per ISP, implement features such as DKIM, VERP, SPF, etc. Assuming this is for opt-in mailings, your primary objective will be to make sure that every message sent will land in a user's mailbox, not their spam box. Be prepared for it to take more time than you realize.

如果你走这条路,你需要定期监控你的服务器声誉,维护与大型ISP的白名单关系,监控和处理退回,为每个ISP设置正确的消息限制,实现DKIM,VERP,SPF等功能。这是用于选择加入邮件,您的主要目标是确保发送的每封邮件都落在用户的邮箱中,而不是垃圾邮件箱中。做好准备比你意识到要花更多的时间。

For transactional email (account signup confirmations, account status reports, billing, etc.), take a look at this SO post for providers with webapp friendly APIs.

对于交易电子邮件(帐户注册确认,帐户状态报告,计费等),请查看此SO帖子,了解具有webapp友好API的提供商。

For marketing email and mass opt-in mailings, take a look at this SO post. I just added MailChimp to that list.

对于营销电子邮件和大量选择加入邮件,请查看此SO帖子。我刚刚将MailChimp添加到该列表中。

#1


4  

You will need to learn everything you can about the SMTP protocol, even if you are using higher level tools that do most of the work for you. In my own experience with processing outbound and inbound emails with .NET, I didn't really "get it" until I learned to telnet to port 25 of an SMTP server and send en email by issuing the commands myself.

您将需要了解有关SMTP协议的所有信息,即使您使用的是可以为您完成大部分工作的更高级别的工具。根据我自己使用.NET处理出站和入站电子邮件的经验,在我学会telnet到SMTP服务器的端口25并通过自己发出命令发送电子邮件之前,我并没有真正“得到它”。

If you are sending lots of emails out and you need to monitor NDRs (non-deliverable reports), you will have to set the SMTP envelope sender address to your own server and parse all of those emails when they come in to figure out what happened.

如果您要发送大量电子邮件并且需要监控NDR(无法交付的报告),则必须将SMTP信封发件人地址设置为您自己的服务器,并在他们进入时解析所有这些电子邮件以找出发生的情况。

The System.Net email classes don't allow you to set the MAIL FROM in the conversation with the MTA without also setting the From address in the email header to the same thing, so you will need to use a 3rd party library like aspNetEmail if you need those addresses to be different.

System.Net电子邮件类不允许您在与MTA的对话中设置MAIL FROM,而无需将电子邮件标题中的发件人地址设置为相同的内容,因此您需要使用第三方库,如aspNetEmail你需要那些地址不同。

ListNanny is another tool that is helpful to parse NDRs, among other functions.

ListNanny是另一个有助于解析NDR以及其他功能的工具。

I'm not sure about serializing the MailMessage objects. I think it would be simpler to just store the separate data elements themselves and then instantiate MailMessage objects when you need them.

我不确定序列化MailMessage对象。我认为单独存储单独的数据元素然后在需要时实例化MailMessage对象会更简单。

#2


1  

You may find some of the answers to Handling undelivered emails in webapp useful.

您可以在webapp中找到处理未传递电子邮件的一些答案。

#3


1  

I suggest you seriously consider outsourcing your email services. I've looked into building a service like this for my webapps as well, but there are many things you will have to keep on top of that will take your time away from your primary webapp (unless of course, you are making this service your primary offering). Third party services take the headache and ongoing maintenance out of the picture.

我建议你认真考虑外包你的电子邮件服务。我也考虑过为我的webapps构建这样的服务,但是你需要保留很多东西,这将花费你的时间远离你的主要webapp(除非你正在使这个服务成为你的服务)主要提供)。第三方服务将头痛和持续维护排除在外。

If you go this route, you will need to regularly monitor your server reputation, maintain whitelist relationships with the big ISPs, monitor and handle bounces, set up correct message throttling per ISP, implement features such as DKIM, VERP, SPF, etc. Assuming this is for opt-in mailings, your primary objective will be to make sure that every message sent will land in a user's mailbox, not their spam box. Be prepared for it to take more time than you realize.

如果你走这条路,你需要定期监控你的服务器声誉,维护与大型ISP的白名单关系,监控和处理退回,为每个ISP设置正确的消息限制,实现DKIM,VERP,SPF等功能。这是用于选择加入邮件,您的主要目标是确保发送的每封邮件都落在用户的邮箱中,而不是垃圾邮件箱中。做好准备比你意识到要花更多的时间。

For transactional email (account signup confirmations, account status reports, billing, etc.), take a look at this SO post for providers with webapp friendly APIs.

对于交易电子邮件(帐户注册确认,帐户状态报告,计费等),请查看此SO帖子,了解具有webapp友好API的提供商。

For marketing email and mass opt-in mailings, take a look at this SO post. I just added MailChimp to that list.

对于营销电子邮件和大量选择加入邮件,请查看此SO帖子。我刚刚将MailChimp添加到该列表中。