[wp-hackers] Adding phpmailer options (smtp for example)

Callum Macdonald lists.automattic.com at callum-macdonald.com
Fri Aug 31 12:49:46 GMT 2007


Hey westi,

I hadn't noticed the filter, but you're absolutely right, that would be 
called at the right point and would most likely work (I haven't tested 
it yet). I might well rework my plugin to use that approach. I'll 
probably do that when I add the option page.

Thanks for the feedback.

Cheers - Callum.

Peter Westwood wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Callum Macdonald wrote:
>   
>> Ok, I've whipped up a plugin. It's a copy of the original wp_mail()
>> function but it adds SMTP by default (to localhost) and a couple of
>> other config options. They're currently only configurable within the
>> file itself, but if it's a popular plugin I'll be happy to add an
>> Options page to make it easier to configure.
>>
>> Any feedback would be much appreciated.
>> http://www.callum-macdonald.com/code/wp-mail-smtp/
>>     
>
> Nice plugin.
>
> But it misses on the simplicity of the task in hand.
>
> This is actually all you need:
>
> <?php
> /*
>  * Plugin Name: pjw-wp-mail-smtp
>  * Version: 0.1
>  * Plugin URI: http://blog.ftwr.co.uk/wordpress/
>  * Description: Get PHPMailer to use smtp not mail()
>  * Author: Peter Westwood
>  * Author URI: http://blog.ftwr.co.uk/
>  * */
>
> add_action('phpmailer_init','pjw_phpmailer_init');
>
> function pjw_phpmailer_init($php_mailer)
> {
>     $php_mailer->Mailer = 'smtp';
>     $php_mailer->Host = 'localhost';
> }
> ?>
>
> The hook phpmailer_init is called just before ->Send in trunk and you
> can just override the few parameters and not have to replace the whole
> of wp_mail.
>
> Hope this helps.
>
> westi
> - --
> Peter Westwood
> http://blog.ftwr.co.uk
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFG1u7vVPRdzag0AcURAsAbAJ9HV4dCyIuruiUe+btA1TlPTAPV4gCeIh7Q
> UyRxCo3v2hAi+Pw7i/5hi7s=
> =NjUf
> -----END PGP SIGNATURE-----
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
>   



More information about the wp-hackers mailing list