0

I just wrote my first mail script in php. It is working well, but I cannot control
the senders email address or name. I would like to at least choose senders name.
Here is the code I am using

<?php
$email=$_POST['email'];
$subject = "New Mailing List Signup";
$body = "test email script";
mail($email,$subject,$body)
?>

I have tried using $from = "emailaddress@email.com"
and also From "emailaddress@email.com" in the mail() tag

No matter what I put I get this...
youngloks@linhostssl08.prod.mesa1.secureserver.net

Can someone help me. Also, this script works on my GoDaddy server but not on my server
with cPanel.

Thanks in advance.

1
Contributor
1
Reply
2
Views
10 Years
Discussion Span
Last Post by lilokster
0

I figured it out on my own. Here is the answer for anyone else who might have the same problem.

<?php
$email=$_POST['email'];
$subject = "New Mailing List Signup";
$body = "test email script";
$header='From: Name<name@website.com>';
mail($email,$subject,$body,$header)
?>

Now it works exactly as I needed it to

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.