Cc header in wp_mail() not working
Cc header in wp_mail() not working
Cc header in wp_mail() not working
Turns out that the issue within the code was neither the WP CRON nor was it the function that performs a WP_Query and SQL query of a custom DB table. As standalone functions, they both worked perfectly. The problem actually ended up being that I specified a timezone in the WP CRON using date_default_timezone_set( ‘America/Los_Angeles’ … Read more
Sometimes the mail port can get clogged up, so I usually add a brief sleep(10) in the for-loop. The 10 seconds is arbitrary, but it works for my purposes. foreach($entries as $key=>$entry){ $email = array( ‘[email protected]’ ); $subject = “Documents Requested”; $headers = array(‘Content-Type: text/html; charset=UTF-8’); $message = getDMVemailMessage($entries[$key][‘id’]); $sent = sendDMVNotifyEmail($email, $subject, $message, $headers); … Read more
WordPress Custom wp mail template return full template
Why does WordPress not send password reset emails from the Administrator Address?
Both the mail() function in PHP and wp_mail() in WordPress do support passing an array or string of headers, but the difference is: With mail(), the array keys are the header names and its values are the respective header values, e.g. array( ‘Content-type’ => ‘text/html; charset=utf-8’ ). wp_mail() on the other hand, expects that the … Read more
The issue was not caused by WordPress. It was caused by a plugin. In this particular case, I checked the plugins installed looking for anything that could modify the mail behavior. I disabled the plugin “Email Templates” and started receiving all the messages normally. Then I noted that there was an update available for that … Read more
wp_mail() uses phpMailer which defaults to localhost so if your development server is not configured as a mail server, the email won’t fly. Use the ‘wp_mail_failed’ action hook to get the WP_Error that’s thrown so you can further troubleshoot the problem.
It was the thing in the order of functions, and the check : if(is_user_logged_in()){ $current_user = wp_get_current_user(); } else { $user_id = get_post_field( ‘post_author’, $post_id ); $current_user = get_userdata($user_id); }
$get_file_content = fopen(TEMPLATEPATH . ‘/mail/create-account-member.php’, “r”); // Lê cada uma das linhas do arquivo while(!feof($get_file_content)) { $message .= fgets($get_file_content) . “<br/>”; } fclose($get_file_content); wp_mail( $user_email, $subject, $message, $headers );