Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

rboord on "wp_mail “from” header concatenation trouble"

$
0
0

So I've got a problem with wp_mail sending from the wrong e-mail address. I want it to come from a specific user in this case. My code to get the user's e-mail works, because it echoes properly in the $message section.

The problem seems to be my formatting of the concatenation on the $headers section. Here's my mail codes I've tried, to no avail. This first one was from another stackoverflow post.

$headers = "From:" . apply_filters( 'wp_mail_from',$fromEmail);
wp_mail($to, $subject, $message, $headers);

--

$headers = "From:" . $fromEmail;
wp_mail($to, $subject, $message, $headers);

--

$headers = "From: ".$fromEmail."\r\n";
wp_mail($to, $subject, $message, $headers);

I'm ripping my hair out. I have another wp_mail form elsewhere in the site that inputs the $headers variables using the $_POST method, but I'm not using that to get the data. And again, the e-mail echoes in the $message section. So I'm going insane trying to figure out why it's not working.


Viewing all articles
Browse latest Browse all 8245

Trending Articles