Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 23rd, 2006, 04:06 PM
Authorized User
 
Join Date: Dec 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Changing the senders email address in the mail()

I have been trying to find a way to change the name of the senders email when using the mail() function. I would like it to change the senders email address to read something like "Company Name Inc".

The problem is when I set the $from = "From: Company Name Inc"

I get the email with the from being: [email protected]@ourserver....urserv er.com

is there anyway I can change this?

I have found that if I change it to [email protected]

it sends the email with the from being:

[email protected]

I would really like to have it read: "Company Name Inc" period I want to remove the @whatever.com all together.


Thanks for your help

 
Old May 23rd, 2006, 10:24 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 479
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via MSN to surendran Send a message via Yahoo to surendran
Default

$str="body";
$to ="[email protected]";
$from_header = "[email protected]";
$subject="subject";
$contents=$str;
$Sender="Sender Name";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $Sender <[email protected]>\r\n";
$headers .= "Bcc: [email protected]\r\n";
if($contents != "")
   {
      mail($to, $subject, $contents , $headers);
   }
else
   {
          print("<HTML><BODY>Error, no message were sent!");
         print("</BODY></HTML>");
   }

surendran
(Anything is Possible)





Similar Threads
Thread Thread Starter Forum Replies Last Post
setting from address in outlook mail item bishnupokhrel Pro VB 6 1 January 26th, 2011 10:28 AM
E-mail Address Changes Ben Horne Forum and Wrox.com Feedback 1 April 1st, 2004 04:43 PM
Verify for Valid E-mail address eapsokha Classic ASP Professional 2 February 24th, 2004 12:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.