Thanks for the great module.

I have a use case I would like to share and a patch to see if this can be included in the module.

I would like to alter the SMTP server used when emails are being spent to specific addresses.

For example, using smtp server1 for emails going to a gmail.com address and using smtp server2 for emails sent to an outlook.com address.

This can be useful based on cost and deliverability of each 3rd party emailing service.

Comments

AndraeRay created an issue. See original summary.

andraeray’s picture

Status: Active » Needs review
StatusFileSize
new1.01 KB

Here is the patch.

I also had to add a new function getToList() to smtp.phpmailer.inc so that I can access the To address which is a private property of the PHPMailer Class.

wundo’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hi Andrea, thanks for the contribution but I'm not sure why would you need it, also, I think that altering the $mailer object on the fly might be dangerous.

andraeray’s picture

Can you explain why altering the $mailer object can dangerous?

Here is more of my use case.

SMTP Email Provider 1 - charges $0.10 for 1000 emails. But gets flagged as spam with outlook, and msn, aol, and hotmail recipients.
SMTP Email Provider 2 - charges $1.00 for 1000 emails, and does not get flagged as spam by outlook, msn, aol, and hotmail recipients.

So If I send 25,000 emails per month,
SMTP Email Provider 1 charges $2.50
SMTP Email Provider 2 charges $25.00

If I can swap between provider 1 and 2 based on recipient email, then I can end up spending around $11.50 per month with great deliverability,

That's just one benefit of creating an alter hook that other modules can hook into.

Another benefit would be allowing a user to compare two different SMTP providers during the same time period since the server can switch between them.

Another use case is if a user wishes use their own server for SMTP mails, They can start building it's reputation by sending a small percentage of emails to it and increase it as time goes on.

The alter hook simply just opens the possibility for developers to add new features with having to patch or edit this module's code.

bluegeek9’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunatly, Drupal 7 is End of Life and no longer supported. We strondly encourage you to upgrade to a supported version of Drupal.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.