At present, OGM needs the PHPMailer library to operate, but an installation of it in the

OGM has some code in it to check for the availability of the PHPMailer class within PHP, however I found out the hard way today that if it isn't installed, for some unknown as yet reason, the status report (as driven by the code in the ogm_mailinglist.install file) still indicates that is in fact installed, confusing the situation for newbies setting up this module.

I didn't take the time to investigate why the code in the .install file works incorrectly, but since there are other modules that use PHPMailer and there is a PHPMailer drupal module, I'd suggest that a better way to ensure that the PHPMailer library is used and set up is to simply require the PHPMailer module for OGM, and to configure OGM to use the libraries in this module. We'll need to decide whether to use PHPMailer module version 2 or version 3, hopefully version 3 will become the recommended version soonish so we can just go from there. I don't know if we can make it use both versions interchangeably.

Also, using the PHPMailer module allows for configuring PHPmailer to use outside smtp servers, as I understand it, enhancing functionality.

Comments

nigelcunningham’s picture

Just an FYI: I'm working on this at the moment, and hope to check in some code to my branch before the end of the day.

kyle_mathews’s picture

Status: Active » Closed (won't fix)

Making ogm depend on the PHPMailer Drupal module will solve nothing. If there's a bug in the hook_requirements code (which I'm not entirely certain there is -- it's possible that another module could load the PHPMailer class there but not other times that ogm needs it) depending on another module isn't going to fix that.

Requiring PHPMailer would just add another redundant step to the installation process.

Also, you don't need the PHPMailer library to use an external SMTP server, it's not documented or particularly well supported but it'd be trivial for us to setup OGM so people could send emails from external SMTP servers.

So setting this to won't fix. The real blocking issue is #911974: Send all emails through PHPMailer removing dependency on having a Sendmail compatible server

nigelcunningham’s picture

Ah... just to clarify:

I'm working on using phpmailer, not making og_mailinglist depend on the phpmailer module. The only issue I've seen so far with existing phpmailer support is that I had to have

libraries_get_path('phpmailer')

rather than

libraries_get_path('PHPMailer')

to make the installation I'd done for the Libraries and Messaging modules.

kyle_mathews’s picture

Yeah, that's a big weakness of the library module -- if different modules tell you to install a library into different paths... then the shared library stuff doesn't work at all.

kyle_mathews’s picture

Title: Make OG Mailinglist use the PHPMailer Drupal Module » Use the PHPMailer Drupal Module as an optional add-on to support advanced PHPMailer configuration
Status: Closed (won't fix) » Active

Nigel has what looks like a workable solution to using PHPMailer to send out all email over at #911974: Send all emails through PHPMailer removing dependency on having a Sendmail compatible server. Once that goes in, people are going to have a lot more flexibility about how they send out emails.

So our choice is to either support advanced PHPMailer configuration ourselves or make the PHPMailer module an optional add-on and work thorough that module to support advanced setups.

I need to look more closely at the PHPMailer module but I think this might be workable. See my comment here: http://drupal.org/node/911974#comment-3519678

One other nice thing about this is since the point of the PHPMailer is to take over the Drupal core email send function, for those people with funky email needs, by installing the PHPMailer and configuring that, all their email configuration would be handled in one spot.

tobias’s picture

Hiya all,

I just started getting this error after upgrading to the latest from git, when submitting a comment via the website.

Fatal error: Class 'PHPMailer' not found in /var/www/vhosts/kabissa.org/httpdocs/sites/all/modules/og_mailinglist/og_mailinglist_api.inc on line 191

The PHPMailer dir is in the OGM module dir as usual.

Cheers,

Tobias

tobias’s picture

ah - it wants the PHPMailer dir to be lower case phpmailer. I changed it as per install.txt and it now works.

I have to say I only understand about 2% of these threads about PHPMAiler! :/

-t

nigelcunningham’s picture

Assigned: Unassigned » nigelcunningham
Status: Active » Needs review

Should be fixed by recent work on the Sendmail dependency removal: http://drupal.org/node/911974#comment-3748782

kyle_mathews’s picture

To fix this issue, we need to be able to use both the PHPMailer library installed by PHPMailer as well as their SMTP settings which I believe your patch doesn't cover. See http://drupal.org/node/925928#comment-3519708

nigelcunningham’s picture

I wrote this last week and did commit it to git, but have done some more improvements today and ammended the previous version.

Please take a look at the differences between your branch and mine. (There's just one commit).

jsibley’s picture

Will the phpmailer module work out of the box with the latest OGM dev release?

If so, are there benefits to using it? In particular, might it help with the outbound Server response: 400 Connection unexpectedly closed issue I reported by Mailgun?

Thanks.