开发者

How do I test sending email from a web applicatoin on OSX? [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 9 years ago.

Improve this question

I have a Django application run开发者_StackOverflowning locally and I'd like to test the "send_mail()" functionality. Currently, I'm able to turn on postfix using the following command in Terminal:

sudo postfix start

Once I turn on postfix, I run the following command in Terminal:

telnet localhost 25

Those two steps seem to be working because the "send_mail()" function does not fail or result in an exception. Unfortunately, I'm not sure what I should do next to see the emails it's sending. I tried to configure Mail.app to connect to localhost, but no such luck.

Does anyone have insight into what I need to do next to see the emails that postfix is sending?


you could try using the django email test server?

see the docs at http://docs.djangoproject.com/en/dev/topics/email/#testing-e-mail-sending

emails will just be listed as you send them.


Postfix will try to deliver the mails to the system you named. This may fail for various reasons, such as:

  1. The address doesn't exist.
  2. The remote mailserver rejected it.
  3. Your ISP blocks port 25 outbound so postfix can't deliver anything.

You can see queued mails with the sendmail alias mailq (need to be sudo). Postfix also keeps detailed logs in /var/log

If you are sending to @localhost, you need to also setup a POP3 or IMAP server on your system for Mail.app to be able to read e-mail. Without using Mail.app, you can find the system mail spool (/var/mail is a common spot).


Have a look at postfix's log, or the mail queue. If the messages are building up in the queue, then the next thing to do is to configure your postfix to forward messages on to remote MTAs...which is a serverfault.com question ;).


The email test server is great, but it's hard to preview html email at all. Shameless plug, but I've developed an app to help with it.

Add it to your INSTALLED_APPS and point the EmailBackend to it, and you're done. Emails will be stored up on the database and in the admin you can view them, including HTML multi parts.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜