wp_mail() is not working on server

Since PHP Mailer is working fine do you have the same credentials setup for wp_mail? If you’re using an authenticated SMTP for PHP Mailer then you’ll possibly need a plugin to get the authentication into wp_mail. There are a few different ones that all work but one is https://wordpress.org/plugins/wp-mail-smtp/ for example.

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

Send emails with wp_mail() using SMTP configured in plugin

When you’re using something like Easy WP SMTP, what you’re doing is configuring things so that wp_mail() sends using your validated SMTP account rather than the generic mailer on the web server. The a common confusion and misconception is that you are using SMTP OR wp_mail(). Actually what you’re doing is changing what wp_mail() is … 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.

Error when requesting password reset email – wp authentication

Sounds like a server configuration problem, not a WordPress thing. You said you were using Rackspace? I don’t have personal experience with Rackspace but it appears that they have some known issues with the default PHP mail() function. See: http://feedback.rackspace.com/forums/71021-product-feedback/suggestions/1873281-fully-support-php-mail-function- http://www.joshuawinn.com/huge-email-delays-on-rackspace-cloud-sites-dont-use-php-mail/ The primary issue is that sending straight through mail() doesn’t authenticate the sender, using … Read more

Comment Email Notification for CPT Comments

I have figured it out. There were a bunch of issues with the existing code. The code wasn’t getting $author_email appropriately which was causing it to fail and causing wp_mail() not to fire. add_action(‘comment_post’, ‘comment_email_notification’, 11, 2); function comment_email_notification($comment_ID, $comment_approved) { $post_type = get_post_type(); if ($post_type !== ‘jobs’) { return; } $comment = get_comment($comment_ID); $post_ID … Read more

How do I call wp_mail from HTML?

First the way to do this is with a form using the post method, it is slightly easier to understand: <!– form with AJAX action and iframe target –> <form method=”post” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” target=”emailsendframe”> <!– AJAX action field to trigger function–> <input type=”hidden” name=”action” value=”download_email_send”> <!– Post ID field –> <input type=”hidden” name=”intro” … Read more

Mail not sent when I set HTML headers

There’s the wp_mail() function in WordPress. The headers have to be added as array without trailing \n\r or similar. Example wp_mail( ‘[email protected]’, ‘Hello World!’, ‘Just saying…’, array( ‘MIME-Version: 1.0’, ‘Content-type: text/html; charset=iso-8859-1’, sprintf( ‘From: %s <no-reply@%s>’, get_bloginfo(‘name’), site_url() ), sprintf( ‘X-Mailer: PHP/%s’, phpversion() ), ) ); To change the content type you could as well … Read more

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