Reply-To in header overwritten
-
We need to send an email to the administrator requesting to approve an item created. To do so we use a hook containing the code below.
[code]
$url = get_bloginfo('url');
$to = get_bloginfo('admin_email');# need to extract user ID
$user_id = get_current_user_id();
$user_info = get_userdata($user_id);
$firstname = $user_info->first_name;
$lastname = $user_info->last_name;
$emailaddress = $user_info->user_email;/*
$headers = array(
'Content-Type: text/html; charset=UTF-8',
'From: ' .$firstname .' ' .$lastname .' <' .$emailaddress .'>'
);
*/// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";// More headers
$headers .= 'From: ' .$firstname . ' ' .$lastname .' <' .$emailaddress .'>' . "\r\n";//get News Fields
$post_title = get_post_field('post_title',$post_id);
$post_content = get_post_field('post_content',$post_id);$subject = 'Please Approve News Item';
$body = $url . "<br /><br />" .$post_title . "<br /><br />" .$post_content . "<br /><br />Email: " .$emailaddress;$email_sent = wp_mail( $to, $subject, $body, $headers);`
[/code]However when the administrator received the email the name of the sender is displayed but the reply-to address is [email protected].
If I disable the Easy WP SMTP plugin the email functions as it should.
Force From Name replacement is not ticked
Substitute Mode is not ticked.Are you able to help?
Regards,
John ViseurThe page I need help with: [log in to see the link]
- The topic ‘Reply-To in header overwritten’ is closed to new replies.