Release Notes

Changes from previous version:

  • fixed From name bug
  • added smtp authentication toggle to settings

Next version: will work on handling html markup from TinyMCE in plain text emails.


  • SMTP support
  • HTML email
  • File attachments
  • BCCs
  • Additional functionality is easy to add using PHPmailer class

Summary: This plugin overrides the default elgg email notification handler and uses PHPMailer. It currently provides support for using the php mail function or a smtp server. See the included readme.txt for more information.

Description: This plugin provides a wrapper to the PHPMailer class. PHPMailer is used by many open source projects including Wordpress and Joomla. The class provides the abaility to send mail through php's mail function, sendmail, qmail, and smtp. It supports html email, file attachments, and embedding images. See for more details. This plugin provides a simple wrapper around the PHPMailer class.

Installation: Unzip and place in mod directory. Activate through Tools Administration. There are admin settings for smtp and non-standard MTAs. There are further instructions in the readme.txt file.

SMTP: SMTP can be setup in the admin settings of the plugin.

Notes: Other plugins may have their own email sending code and will not use this plugin therefore. The Invite Friends plugin is an example of one. I've added an interface that allows other plugins to send through this plugin (skipping the elgg notify system). This allows someone to write an Invite Friends plugin to check if the phpmailer plugin is installed and send through it if it is. It also makes it easy to build plugins to send email to people outside the social network (example: adding a "share this" link to content that allows users to send emails to friends)

Bug Reports: Please post them in the comments along with any related error message in your server error log. If you did not read the readme file or check your error log, I am much less likely to spend time giving you support.

  • Ok for caracter encoding.

    In phpmail/lib/phpmailer.class.php

    Lign 51 change   public $CharSet           = 'iso-8859-1'; to   public $CharSet           = 'UTF-8';

    And force html mail in mail.php

    lign 28   function phpmailer_send($from, $from_name, $to, $to_name, $subject, $body, array $bcc = NULL, $html = false, array $files = NULL, array $params = NULL)


      function phpmailer_send($from, $from_name, $to, $to_name, $subject, $body, array $bcc = NULL, $html = true, array $files = NULL, array $params = NULL)

    And it should work for us weird caracter users :)

  • Cash,

    in order to get PHPMailer to work with GMail all I had to do was add '$phpmailer->SMTPSecure = "tls";' to mail.php (line 121).

    maybe you could make this into an admin option??

  • Thanks cash, this is working really well.

  • So now with PHPMailer other email servers are readily accepting our emails, but the emails aren't showing up in others' boxes until approx. 1.5 to 2 hours later. I'm sending using a Google Apps for Domains account, which uses the same authentication as normal gmail, and I can confirm that the emails are sending in time and correctly. And they arrive correctly, just hours later. Even to another gmail account (or even another account on the same GAFD domain).

    Could PHPMailer be causing this? I sent an email using the account from the normal gmail interface, and the message arrived instantly. Sending mail through SMTP (by means other than PHPMailer) arrives instantly as well. PHPMailer seems to be the culprit. Anyone know why?

  • This isn't yet definitive, but it seems to be happening mostly (maybe all?) to Gmail accounts.

  • @Kev We run our own internal mailserver on the same physical network as our Elgg server, and phpmails are instant. Maybe a gmail issue?

    There are many reports arround the net of gmail delay issues. I would be inclined to test again later and see if it resolves itself. If they do eventualy get there then this is a little differnet than vanashing emails.

  • @Kev - I have seen delays with receiving emails at gmail addresses. In my experience they tend to be intermittent and I tend to doubt phpmailer has anything to do with it. I agree with johno - see if it resolves itself.

  • Yeah, I'm just glad the emails aren't getting flagged as spam anymore. At least this is a step in the right direction! Thanks for sticking with me, fellas. I might just need to set up a second mail server on the same server as Elgg and run PHPMailer through that. We're growing by the hundreds daily, and I'm just having a huge time answering these support questions that keep coming in about emails not arriving!

  • @Kev - Here is a link I posted elsewhere:

    It's for a service that will evaluate email headers and server records. I've never tried it but it might come in handy for someone else.

  • @Cash - Thanks for the link. I ended up signing up with instead. They also do browser rendering, and it ended up being cheaper by the month.

    Turns out that the emails pass every spam test with flying colors except for Postini, and that filter just brings the hammer down. I'm reworking the wording on my email validation emails, but damn...

  • @Cash - Just an update, hopefully one that'll be helpful to others. Based on the returned emails I'm getting from the rejecting servers, it's mostly Comcast (which I believe uses Postini) with a few Bellsouth, Yahoo, and Hotmail addresses that are blocking our site's emails.

    I've tried about 30 different variations of the site notification emails on, and they're ALL failing the Postini filter by a huge margin. The rest of the spam filters give the emails a passing grade by a comfortable margin. I'm really not sure what's going on here.

  • Quick question again, Cash. Is there any way to have the emails from the site sent from a domain other than the SMTP account being used to send it?

  • I may be a little slow this morning. Are you asking whether you can change the from address? If so, yes, Otherwise can you explain what you mean?

  • Well, the Google Apps account we're using has (as an example) setup as the primary, as well as setup as an alias. We've since changed all our branding to go with instead of the first, and we'd like our emails to show that they're coming from that address, but our Google Apps username is still, so the emails show that they're from that address. Is there no way to have an email show a different "from" address than the account that's actually being used to send it?

  • @Kev - With most smtp servers, you would just need to change the site email address under Site Administration. I've done that in my tests and it has worked. I haven't played around with gmail much.

  • using the plugin
    After users register to mark Error 500 
    to refresh and red message: Form __token is missing or __ts fields

    Any idea?

  • @abelardo - thanks for trying out the plugin. The plugin has nothing to do with the error message. You either modified the registration form or added a plugin that changes the registration form.

  • Where are tyhe gmail settings that you use to setup this plugin to use gmail as the smtp server?

  • Ignore my last - I found them.

    Is the plugin supposed to send a confirmation email message to the account when its setup?

  • @jededitor - I suppose that would make sense if the plugin is being used for smtp. It doesn't do that right now but I'll consider it for a future version.

  • I checked it was working by just sending an invite to myself at all my email address's. Funny thing was that it came through quite fast on google and yahoo but, two hours later, theres no sign of anything on my normal isp mail account....

  • Damn -- it doesn't operate through the Invite Friends plugin does it?

    <sounds of someone banging their head on their desk top in background>

  • @jededitor - The invite friends plugin (and all current variations) has its own custom mail sending code that talks directly to the pgp mail function. There is no way for my plugin to intercept that.

    The problem is that the Elgg core only provides an interface for sending emails to members. I added a ticket about adding support for sending email to non-members a few months ago, but it doesn't seem there is any interest in it:

    The other possibility is releasing an invite plugin that checks if phpmailer is enabled.

  • Cash, this is fantastic, and I'm so glad I finally found this. Thank you. I have a question though ... in your notes above you state:

    @Cash: This allows an Invite Friends plugin to check if the phpmailer plugin is installed and send through it if it is.

    In your reply to jededitor immediately above you say:

    The invite friends plugin (and all current variations) has its own custom mail sending code that talks directly to the pgp mail function. There is no way for my plugin to intercept that.

    Presumably this is not contradictory. But could you explain the distinction between those two statements, for me, and perhaps others ?

    I'm hoping for some certainty that my users can continue to use 'invitefriends' mod but that issues of mail not being sent if multiple addresses are entered will be resolved.



  • Category: Communication
  • License: GNU General Public License (GPL) version 2
  • Updated: 2014-11-17
  • Downloads: 17700
  • Recommendations: 33

Other Projects

View Cash's plugins