Best practise to send mass email within application (ASP.NET MVC 2, C#)?

北战南征 提交于 2019-12-04 21:54:26

ANother thing: do NOT use gmail. First, gmail has limits - anyhow, use no external server at all.

I do stuff like that, and I use a drop directory on the hard disc, then use an MTA (SMTP service in Windows acutally) to do the actual transfer.

This way I finish fast (just file generation) while the actual emails can take longer.

If you want to hide who it's going to in case 2 why can't you put the recipients into the BCC of MailMessage?

One thing I would recommend is to define your email settings in your web.config like below:

<configuration>
  <!-- Add the email settings to the <system.net> element -->
  <system.net>
    <mailSettings>
      <smtp>
        <network 
             host="relayServerHostname" 
             port="portNumber"
             userName="username"
             password="password" />
      </smtp>
    </mailSettings>
  </system.net>

  <system.web>
    ...
  </system.web>
</configuration>

If you got too many e-mail in "emailAddresses" instance, you would face the time-out problem. You might considering a tiny Windows Service app to handle sending function. It works for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!