Quick question about $headers and phpmailer


This is what I use to send mail:

mail($visitormail, $subject, $message);

But when it sends, it just shows the e-mail address in the “From” field when the recipient opens it. I dabbled with “$headers” after some research, and just couldn’t get it to work. I simply want it say like “From: xxx” when sent. Please help! Thanks!


Did you check out here?


Scroll down to " Example #2 Sending mail with extra headers."

1 Like

Hmm…that is sorta what I was looking for, but I’d like the “From” in the recipient’s inbox to be my name and then the e-mail address. Right now it says this for example: “e-mail address” “e-mail address” where I’d like it to say “zoldos” “e-mail address”.



You mention phpmailer in the title, I’d recommend using it :slight_smile:

1 Like

If i understand you correctly then try like this:

From: zoldos < zoldos@website.com > (just remove spaces after < and before >)

And yes as @JimL said, PHPmailer is much better solution.

1 Like

@COLT Where do I put that? :slight_smile:


@JimL It’s working fine right now, so I’d rather not do a bunch of extra coding. I just wanted to personalize the sent e-mail. :slight_smile:


try like this just use your e-mails and names:

$to = ‘nobody@website.com’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From: John Doe < colt@website.com >’ . “\r\n” .
‘Reply-To: colt@example.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers);

and again, just remove space after < and before > (because if there is no space this editor here dont show them)

1 Like

k got it:

$headers = "From: zoldos <zoldos@email.com>"