Articles of wp mail

Wp_mail() function not working in Windows and MAC OS

Not getting mails when sent from Windows OS and MAC OS but getting when sent from Linux OS. I tried sending mails from LINUX OS,Windows and MAC OS LINUX sending me the mails as it should do but windows and MAC failing to send the mail I am getting Mail sent successful message, but not […]

trigger email when post is published by someone a user follows

I’m trying to send an email to all users who are following a certain post author when they publish a post. I have this function below, but does not seem to work. a few notes the meta value = ‘following’ is an array that contains the authors user follows. function followerPost_notification($post_id) { $post = get_post($post_id); […]

Is there a way getting post fields using `transition_post_status`

First I tried fetching post_meta data, and latest, I tried fetching get_post_field() inside a transition_post_status hooked function, like: <?php add_action( ‘transition_post_status’, ‘yes_send_email_notification’, 10, 3 ); function yes_send_email_notification( $new_status, $old_status, $post ) { if( ‘mycpt’ === $post->post_type && ‘new’ === $old_status && ‘pending’ === $new_status ) : $post_id = $post->ID; /** * Generate Dynamic values */ […]

Condition within single.php to send an email to the post author

I have this piece of code (below) that checks if the post was modified within the past 7 days. I’d like another piece of code that I can insert where “Needs Updating” is that will send a basic email to the post author that says “Someone was looking at your post and wants it updated” […]

Sending HTML email with attachment with wp_mail()

This one should be easy, but I can’t figure it out. I want to send an email that is HTML formatted, but also has an attachment. The attachment is being sent correctly, but the message is delivered as plaintext, like this: <p>Hello!</p> <p>&nbsp;</p> <p>Some text.</p> <p>&nbsp;</p> <p>Best wishes,</p> <p>Team</p> If it was an email without […]

Send Weekly Email if Users have not complete their profiles

I’ve created a function to send an email each week, but it doesn’t seem to work and I don’t know why. In addition I have several doubts because of my lack of experience with wp_cron and wp_mail, so here’s what I need and my doubts, and below my code: Set a weekly recurring event. (link) […]

Multiple email recipient using wp_mail()

I want to define multiple recipients email address outside the array. like $adminmail = get_option(admin_email); $adminmail2 = like an email address; $multiple_recipients = array($adminmail,$adminmail2); $subj = ‘The email subject’; $body = ‘This is the body of the email’; wp_mail( $multiple_recipients, $subj, $body ); Is this possible ?

Sending mail not working correctly

SITUATION I have a reserve system for a restaurant and I’m trying to send data out of my wpdb to myself with the mail() function around 3pm. So I get a overview of all the reservations for the current day. Everything is working fine except for my mail() function because it just sending data of […]

wp_mail ignores the name in From field

I am trying to set custom From name and email in wp_mail headers but somehow, wp_mail ignores the name but gets the email correctly. This is the headers code I am using. $headers = array( ‘Content-Type: text/html; charset=UTF-8’, ‘From: Michelle Titus <>’ ); I am not using such plugins which can alter the data. However, […]

How to send multiple email to different addresses

I know this is already a common question, i tried to google it. but its not helping. i tried to play with the codes but still not working. <tr> <th><label>Admin Email: </label></th> <td><input type=”text” name=”adminemail” value=”<?php echo esc_html( empty($options[‘adminemail’])?”:$options[‘adminemail’] ); ?>” /></td> </tr> //———————-// $admin_mail = empty($options[‘adminemail’])?”:$options[‘adminemail’]; $headers = ‘Content-type: text/html’; $email_title = htmlspecialchars_decode( get_bloginfo(), […]