How to create a CSV on the fly and send as an attachment using wp_mail?

That’s because wp_mail expects the attachment to be a filename (filepath) that it can attach and send. You are supplying a string containing the contents of the file: function create_csv() { $filepath=”/path/to/the/file.csv”; $fd = fopen($filepath, ‘w’); if($fd === FALSE) { die(‘Failed to open temporary file’); } $records = array( array(‘dummy’, ‘data’, ‘found’, ‘here’) ); fputcsv($fd, … Read more

apostrophe in email name

Filter is_email and sanitize_email, then apply a better check: namespace Wpse\Email; add_filter( ‘is_email’, __NAMESPACE__ . ‘\check_mail_address’, 10, 2 ); add_filter( ‘sanitize_email’, __NAMESPACE__ . ‘\check_mail_address’, 10, 2 ); function check_mail_address( $result, $email ) { return filter_var( $email, FILTER_VALIDATE_EMAIL ); } The PHP function is still not RFC 5321 compliant, but better than the WordPress check.

Send PDF link in email based on radio button selection

You should use the same name attribute for your 2 radio inputs. So let’s say that name is language. If language is set, you have 2 options represented by value, either English or Chinese. In the code you posted, that is mainly your problem. You set your $radio variable to be $_POST[‘language1’] but $_POST[‘language1’] will … Read more

WP Mail SMTP: What do the SSL/TLS options mean? [closed]

WP Mail is just a wrapper for configuring WordPress’s PHPMailer (wp-includes/class-phpmailer.php). PHPMailer’s documentation says: Encryption flavours There are two “flavours” of transport encryption available for email: “SMTPS”, also referred to as “implicit” because it assumes that you’re going to be using encryption right from the start of the connection. In PHPMailer this mode is selected … Read more

Posting via email, where do I start troubleshooting?

You’re obviously posting it to a mailbox that WordPress is accessing, so check the mailbox that your friend has sent an email to, if the email is still in there then WP hasn’t taken it out and thus your email settings in WP are probably wrong. If the email isn’t in there your friend has … Read more

Joining confirmation email

Not sure how to close this post. I used WP better emails plugin http://wordpress.org/extend/plugins/wp-better-emails/ on the subsites and it removed the wordpress email address. (I was only using it on the main site before so it didn’t work.) Thanks.

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