Attach pdf from dynamic url

You can try to do it in two ways. The first one, much more simple, is to save a temporary PDF file somewhere, for example in a uploads directory, use it as attachment and delete if after the call to wp_mail() function is made: function my_custom_save_post( $post_id, $post, $update ) { if( ! $update ) … Read more

If/elseif statement within wp_mail function

This is problem with your PHP syntax, not WP. You are using assignment (=) where you should be using comparison (==). So this: if( $problem_type=”phones” ) should really be this: if( ‘phones’ == $problem_type ) And same for other condition.

wp_mail sending old content from post

There’s a few things you need to do here, you need to modify your add_action() to accept additional arguments and you need to specify whether to use the data before the update or the data after the update. Try something like this: function send_media_emails($post_id, $post_after){ if(defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return; if(get_post_status($post_id) == ‘draft’ or get_post_status($post_id) == … Read more

How dynamically change wp_mail behaviour, sending html or plain text based on conditions?

Here’s an (untested) PHPMailer example to check for e.g. the subject and the content type: function mailer_config( PHPMailer $mailer ) { if( ‘Subject #1’ === $mailer->Subject && ‘text/html’ !== $mailer->ContentType ) { $mailer->IsHTML( true ); } } other options would be to e.g. check the $mailer->From or $mailer->FromName, or some other conditions, depending on your … Read more

What is the most efficient way of implementing a notification system? [closed]

If you’re looking to get in to instant notifications without suffering from backlog, I’d looking in to both Node.js and Socket.io. You should be able to work with them both pretty easily and integrate w/ WordPress. The sample chat application on the Socket.io site isn’t a far cry from what you’d be doing. Basically an … Read more

wp_mail sending mail twice!

Thanks for the comments! I figured it out. I tried the regular php mail function and still the same thing. Then I decided to make a page template and add only the mail() function, get_header(), and get_footer(). It still sent it out twice. So I opened my header.php and commented the wp_head() function to rule … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)