Problems? Is your data what you think it is? | |
PerlMonks |
Replacing a module dependencyby Bod (Parson) |
on Apr 26, 2022 at 23:34 UTC ( [id://11143334]=perlquestion: print w/replies, xml ) | Need Help?? |
Bod has asked for the wisdom of the Perl Monks concerning the following question: We send automated emails with things like registration verifications automatically. We user MIME::Lite to do the sending and use the default send mechanism which is sendmail as it is a Linux server. But we are having some issues with deliverability. So, I decided to switch to using SMTP instead to see if that works more reliably. To send via SMTP MIME::Lite uses Net::SMTP which in turn requires MIME::Base64. This last module is XS and I don't have it installed on the shared hosting. We use Net::SMTP elsewhere to send lots of emails so I have looked at what I did in the past to get around this problem. It turns out that I created a new module that inherits from Net::SMTP and overrides the auth method. This works fine as we always send through the same SMTP server with the same authentication. Doing the same will be fine for the MIME::Lite setup. Like this:
But, how can I easily get MIME::Lite to use the new module inherited from New::SMTP? I could created a new module that inherits from MIME::Lite and just override the send_by_smtp with the only change being the require file it calls. But that doesn't seen a very elegant solution! Is there some way to instead put a new version of Net::SMTP in a directory relative to my script and get MIME::Lite to use that? If so, how can I inherit from a module of the same name (but a different path) as the new module? Or is there a 'better' solution I am missing?
Back to
Seekers of Perl Wisdom
|
|