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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.