ironcamel / Dancer-Plugin-Email

Simple email sending for Dancer
http://p3rl.org/Dancer::Plugin::Email
6 stars 10 forks source link

Emailing /usr/sbin/sendmail@example.com? #5

Closed ghost closed 12 years ago

ghost commented 13 years ago

I tried to use this module as a simple email dispatcher for my web app. After I got it working with a very simple test emails and configuration (driver: 'sendmail' path: '/usr/sbin/sendmail') I noticed a very odd behaviour, it sends TWO emails every time. One is correctly addressed and sent, but also another one is dispatched to /usr/sbin/sendmail@example.com address?! Which produces bounce, of course. The MTA in tests was Postfix 2.8.3. The version of module used was 0.1300 CPAN tarball.

I spent some time trying to find a reason for such behaviour, but being time limited, I need to go on and use something that works out of box, sorry. This bug report has been encouraged by LoonyPandora.

I also noticed that the plugin uses Email::Send which has since been deprecated in favour of Email::Sender. Which is exactly the module I'm going to try next.

ironcamel commented 13 years ago

Thanks for taking the time to create this ticket. Unfortunately, I am not able to reproduce this behavior. The string 'example.com' does not even exist anywhere in this codebase. Nor do I see any way possible for an email to be sent twice. This is very strange indeed. @alnewkirk, do you have any ideas?

ghost commented 13 years ago

Well, example.com is just an... example. Instead of it my local domain was appended. It could be something specific to Postfix, maybe the module provided '/usr/sbin/sendmail' path in the place where postfix's sendmail binary is expecting recipients, or something like that. Though I've never seen it before and postfix is reasonably compatible with legacy sendmail.

alnewkirk commented 13 years ago

Sure guys, I'll take a look into, ... interesting that this is the first time anyone has had an issue like this and this plugin has been around and in use since the Dancer early-days. If there is an issue its probably in the::Driver::Sendmail library. Ahhhhh, I just did a search for the word depreciated in the Email::Stuff library and its no longer there, plus now it has a note that the name and API are subject to change. Looks like rjbs is revamping this, I would ask him whats going on.

ghost commented 13 years ago

'Bout deprecation, it's slightly more complicated. Dancer::Plugin::Email uses Email::Stuff, which uses Email::Send. The last one is deprecated since 2008, quote: "Email::Send is going away... well, not really going away, but it's being officially marked "out of favor." It has API design problems that make it hard to usefully extend and rather than try to deprecate features and slowly ease in a new interface, we've released Email::Sender which fixes these problems and others. As of today, 2008-12-19, Email::Sender is young, but it's fairly well-tested. Please consider using it instead for any new work." [http://search.cpan.org/~rjbs/Email-Send-2.198/lib/Email/Send.pm]

ironcamel commented 13 years ago

I actually have thought for a while about reimplementing this module to use Email::Sender::Simple instead of Email::Stuff. The implementation would actually be much simpler. For example, instead of having to call multiple methods of the Email::Stuff object to set To/From/etc. fields, it would be much, much cleaner to simply pass the users data structure to Email::Simple->create and then send that off with Email::Sender.

ghost commented 13 years ago

I think that is a very good idea. Actually, I'm using Email::Sender::Simple now, and it has been working great. IMHO, the biggest advantage is that Email::Sender::Simple is actively maintained.

ironcamel commented 12 years ago

I have refactored this module to use Email::Sender. Hopefully that will encourage you to give it another shot :) If you do, please let me know if you run into any issues. Thanks.