User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,526 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,807 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 509 | Replies: 1
Reply
Join Date: Oct 2007
Posts: 2
Reputation: lilokster is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lilokster lilokster is offline Offline
Newbie Poster

Question PHP mail question

  #1  
Oct 3rd, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 2
Reputation: lilokster is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
lilokster lilokster is offline Offline
Newbie Poster

Re: PHP mail question

  #2  
Oct 3rd, 2007
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
Last edited by lilokster : Oct 3rd, 2007 at 1:39 am. Reason: forgot closing tags
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 4:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC