[wp-hackers] wp_mails ability to embed images

Hanif Bali hanif at moderat.se
Tue Nov 27 10:51:06 GMT 2007


Hi,
i have a long time used the flexibility of the phpmailerclass and its easy
function to embed images in mail.

Now that im working och a plugin (christmas e-cards) for wordpress.

the wp_mail function allows you to pass variables to override some
variables through the $headers array;

   function wp_mail( $to, $subject, $message, $headers = '' ) {   

but you cant pass functions like phpmailers: AddEmbeddedImage();

fortunatly the wp_mail function does a:

do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );

before it sends the mail.

so i hook in:
do_action('phpmailer_init','addimage_mailer');

the function:

function addimage_mailer(&$phpmailer){
$phpmailer->AddEmbeddedImage('C:\path\to\image.jpg', "my-attach",
"vykort.jpg");
}

but it doesnt work, the mail does not have any attachments.

Something wrong?



More information about the wp-hackers mailing list