4

I'm interested in adding outgoing email support to a Pyramid-based web-app. I'm aware of pyramid_mailer and marrow.mail (formerly known as TurboMail), with pyramid-integration example here.

There is a similar SO question, but it doesn't quite give me the experienced opinion I am looking for.

I have no experience with either, but both seem pretty reasonably well-cooked. My needs are modest, and will be very low traffic... ease of use would trump performance should they be in conflict. Both have transport support that will work for me (I don't need any fancy delivery features).

On first glance, I like that pyramid_mailer supports the repoze.tm2 transaction hook, which would be handy for my project (I'm sure I could hack-in marrow.mailer to do the same, but I'd rather not do that work without good reason). And also I like that embedded images are supported on the Message() body in marrow.mailer (leading to a possible conclusion that the latter is more fully formed).

I'm looking for opinions, recommendations, and maybe example-integration code.

I found a mailing-list discussion that covers this too.

Community
  • 1
  • 1
Matt Feifarek
  • 510
  • 2
  • 8

1 Answers1

5

The experienced answer is that if you just want to send email through a SMTP server, pyramid_mailer is way easier to configure and execute. The Message class is from Lamson, which is tried and true, stable, tested and supports whatever you might want to send in an email including attachments and html. The mailer also supports simply dumping all of the messages to a queue directory, where later you can just run bin/qp /path/to/queue/dir to send out the emails asynchronously.

The other side of the story is that Turbomail has been around for a while, it's now renamed to marrow.mailer and supports a ton of backends, not just SMTP. Alice has been actively working on adding the transaction support to integrate with repoze.tm2, so there is definitely interest in making marrow.mailer a more attractive solution.

Michael Merickel
  • 23,153
  • 3
  • 54
  • 70
  • Thanks, Michael. A follow-up question: Perhaps there is no distinction, but I'm interested in "inlining" images into html-mail... I understand that both Message() objects support _attachments_ but I'm not sure that it's the same as inlining or what marrow.mailer calls embedding. Lamson docs [here](http://lamsonproject.org/docs/api/lamson.mail.MailResponse-class.html) don't explain it quite to my question, though it seems like what I want to do isn't exotic, and must be supported by Lamson. The marrow.mailer readme [here](https://github.com/marrow/marrow.mailer) _does_ make a distinction. – Matt Feifarek Jul 11 '11 at 19:01
  • Does this help? http://code.activestate.com/recipes/473810-send-an-html-email-with-embedded-image-and-plain-t/ I guess the point is that lamson can do it as it's just a wrapper around the email library. – Michael Merickel Jul 13 '11 at 04:12
  • Thanks, nice example, but no, it doesn't help in this case. pyramid_mailer is a thin wrapper around Lamson, and Lamson doesn't provide similar api to add headers to an image. After the message is cooked into MIME, if you walk the parts, you can add headers to mime bits, but you can't send the cooked mime using the mailer. – Matt Feifarek Jul 13 '11 at 05:35
  • It also doesn't appear that the attachment api to the Mailer() accepts MIMEImage... – Matt Feifarek Jul 13 '11 at 05:49