Whats the current status with D7 Phpmailer?
I used on D6 as a tool that helps me not sending any email to customers from staging and development instances thanks to its debug email feature.

But on D7, Ubercart is sending email to customers even when Phpmailer is on. Ubercart is using drupal_mail which is a normal, but received mails were not sent via Phpmailer at all but rather through www-data (server) and mail.inc.

The question here is: does D7 Phpmailer work at all, does it have some issue with drupal_mail...?
I can assist and provide any further info or debugging if needed. I really dont want to look for alternatives as Phpmailer was a great partner in development process for a long time.

Comments

oadaeh’s picture

Category: bug » support

Yes, it does work. I use it on my computer to send test messages when developing. Without it, I could not send mail.

You probably are missing some configuration setting or have some other module intercepting the process.

Do you have the Mime Mail module installed? If so, check to make sure that its "E-mail engine" setting is set to "PHPMailer: Mailing engine using the PHPMailer library." on its configuration page: admin/config/system/mimemail

milovan’s picture

I do not have Mime Mail installed / downloaded so not using it.
I do have Phpmailer configured properly and test email is going to the debug_email address instead the one I typed in in the test, so it does work.
Making an order as anonymous or registered user in website's store that Ubercart provides, all emails sent by Rules for successful shopping goes to respective addresses instead to the debug_email address.
Mail headers clearly show that email wasn't sent by Phomailer, unlike test email that confirms it. At first I thought the problem might be tokens but its not. If I write down mail address instead token, it still sends to that address instead debug_mail address.

From modules, I use:
Phpmailer, Ubercart, Admin menu, Apachesolr, Imce, a couple of Media and CCk modules, Views, i18n... So nothing really special.

Checking the code in Ubercart, to be precise in it submodule "order", I see they use drupal_mail hook to send those emails. Code looks fine so the only thing that stinks in the whole story atm is Phpmailer.

Any ideas? If more info needed, I ll provide. Thanks.

milovan’s picture

I put today debugger on and confirmed that when sending for example invoice mail or order mail from Ubercart, it never enters or uses Phpmailer class. It simply goes to mail.inc in core and finishes stuff there through drupal_mail and upon success returns back in ubercart to write message that its sent.

Then I examined sending test mail from Phpmailer and it used Phpmailer class and processed all ok. Also watched debugging results when admin makes new user's account and uses "send notification to user". That email also uses Phpmailer.

So there seems to be an issue Phpmailer versus Ubercart?
Note that I used Ubercart - Phpmailer combo on D6 and it worked.

This is an example of execution round for sending invoices via admin panel in order page:

  • admin enters on which mail to send invoice
  • it stops in uc_order.admin.inc function uc_order_mail_invocie_form
  • then it jumps to uc_order.module line 568 which is function uc_order_mail in case "invoice"
  • from there it goes to mail.inc on line 165 which is drupal_alter
  • then it goes to uc_order_invoice_form_submit line 1328 in uc_order.admin.inc and checks if mail was sent. If yes, set drupal message

So nowhere gets in touch with Phpmailer at all! I believe for reproducing this D7, Ubercart and Phpamiler would be enough. Just make a product, let anon or user buys it and check if rules are set to send mail to user for order on email.

oadaeh’s picture

Status: Active » Closed (works as designed)

Actually, in order to install a "clean" test installation, ctools, entity, libraries, rules, and views must also be installed.

Your problem is because Ubercart is defining a number of mail-systems with which to send email, and all of them are set to 'UbercartMailSystem'. From line 142 of uc_store.install:

'uc_order' => 'UbercartMailSystem',

You will need to change that (and any of the other five you want to receive mail through) to 'DrupalPHPMailer' in order for it to work with this module.

milovan’s picture

Ok I solved issue by adding module MailSystem. Then added module Mime Mail to handle HTML UC mails and now all works. For what I had on D6 where 1 module was used (Phpmailer), on D7 I need to use 3.

Thanks for the help oadaeh.