Method for email testing

2019-01-31 17:22发布

I am writing a program that will be emailing reports out many (~100) clients which I want to test before I spam everyone.

I want to do a test run against my production data and actually send the messages to a SMTP server, but I don't want the SMTP server to actually deliver the messages. I want the server to act like a real SMTP server from the perspective of my application, but instead of delivering messages, I just want it to store the messages, and log what happened.

Is there a SMTP server specifically designed for testing purposes?

Does anyone know of a way to configure exim or postfix to behave like I have described above

What do you use to test a mass-email delivery?

14条回答
劳资没心,怎么记你
2楼-- · 2019-01-31 17:38

If you're looking to manually test that the email sends and that the email template has the right kind of html and css that you're expecting, then I would recommend maildev https://www.npmjs.com/package/maildev. You can install and run it as a node module and also as a docker container! I've found it extremely handy for basic sanity testing of emails.

查看更多
孤傲高冷的网名
3楼-- · 2019-01-31 17:40

After not beeing happy with the solutions I found, I ended up writing developmentSMTP, easy to use, 100% Java --> cross platform.

Supports writing emails to file, forwarding emails or simply printing them on stdout.

查看更多
霸刀☆藐视天下
4楼-- · 2019-01-31 17:41

A good program for email testing is smtp4dev (Windows only).

It's a dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected.

http://smtp4dev.codeplex.com/

查看更多
霸刀☆藐视天下
5楼-- · 2019-01-31 17:44

At my office, we have a server that is set up to always send all incoming mail to one address, regardless of who it's actually addressed to. We just point all our testing environments at that server and watch the QA mailbox fill up. I don't know what server it is, but it's probably some open source thing someone found.

查看更多
该账号已被封号
6楼-- · 2019-01-31 17:49

For .NET I set the config file to deliver mail to a folder, then you can have the automated test inspect the directory and files.

<system.net>
 <mailSettings>
  <smtp deliveryMethod="SpecifiedPickupDirectory">
   <specifiedPickupDirectory pickupDirectoryLocation="c:\pickupDirectory"/>
  </smtp>
 </mailSettings>
</system.net>
查看更多
forever°为你锁心
7楼-- · 2019-01-31 17:50

Sendmail has a Test Mode.

You just invoke sendmail with the -bt parameter. As an example:

/usr/lib/sendmail -bt -Ciu-testconfiguration.cf

Please be aware that in this method, Sendmail requires an special configuration on rewrite rules. You need to understand how Sendmail rewrites addresses in order to properly create a .cf file for Test Mode.


Edit: See this article: http://ussg.iu.edu/usail/mail/debugging/

查看更多
登录 后发表回答