1

I would to customize the sender of the email so I am trying to set properly the headers of the email.

This is the cose I use to customize the headers:

$current = wp_get_current_user();
global $user_email;
get_currentuserinfo();
$headers_mail = "From: ".$current->first_name." ".$current->last_name." <".$user_email.">" . "\r\n";

and this is the cose I use to send the email:

wp_mail($email, $subject, $message, $headers_mail);

Unfortunately the sender of the email is always set to "WebsiteTitle " where WebsiteTitle is an alias for the real title of the website and mydomain.com is an alias for the real domain of the website.

How can I overwrite the headers of the email? Is there any filter that I should use?

pAkY88
  • 6,262
  • 11
  • 46
  • 58

2 Answers2

0

Solved. I used wp_mail_from and wp_mail_from_name filters. An excellent documentation can be found here http://adambrown.info/p/wp_hooks/hook/wp_mail_from?version=3.2&file=wp-includes/pluggable.php and here http://adambrown.info/p/wp_hooks/hook/wp_mail_from_name?version=3.2&file=wp-includes/pluggable.php

pAkY88
  • 6,262
  • 11
  • 46
  • 58
0

You can also use an excellent WP Mail SMTP plugin

karevn
  • 577
  • 3
  • 4