Re: Adding a cc to a PHP mail script...
| From: | Mike Flynn | Date: | Mon, 26 Nov 2001 15:17:56 +0000 |
| Subject: | Re: Adding a cc to a PHP mail script... | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10641@lists.php.net to get a copy of this message | ||
Tony.. you may want to brush up on strings in the PHP manual.
http://www.php.net/manual/en/language.types.string.php
The .= operator *appends* to an *existing* string.. so when you are defining a string for the first time, you must use just the plain equal sign =. After that point, you can use the .= to append to it.
$a .= 'hi';
is equivalent to
$a = $a . 'hi';
similar to how
$a += 10;
is equivalent to
$a = $a + 10;
So, in this case, change your header definition around a bit:
$mailheaders = "From: My Website\n"; $mailheaders .= "Cc: $other_email\n"; $mailheaders .= "Reply-to: $sender_email\n";Also, you should probably change the "Reply to" header to "Reply-to" (as I've done here). -Mike At 10:31 PM 11/18/2001 -0600, you wrote:
Daniel, I tried your suggestion (see below) but the letter gets bounced back like this: tony@gonefishingguideservice.com,linda ..................... Here is the script: <? $msg="Email sent from WWW site"; $msg.="Sender's name:\t$sender_name\n"; $msg.="Sender's email address:\t$sender_email\n"; $msg.="Message:\t$message\n\n"; $to="tony@gonefishingguideservice.com, linda@worksbyhand.com"; $subject="Web Site Feedback"; $mailheaders .= "Cc: $other_email\n"; $mailheaders="From: My Website"; $mailheaders.="Reply to: $sender_email\n\n"; mail($to,$subject,$msg,$mailheaders); ?> Simple Feedback Form The following email has been sent: Your Name: <? echo "$sender_name"; ?> Your email address: <? echo "$sender_email"; ?> Message: <? echo "$message"; ?> ................................... ----- Original Message ----- From: Daniel Parsons <daniel.parsons@imlnetwork.com> To: Anthony Ritter <tony@gonefishingguideservice.com>; <php-windows@lists.php.net> Sent: Sunday, November 18, 2001 8:55 PM Subject: RE: [PHP-WIN] Adding a cc to a PHP mail script... If you want to add additional email addresses to the 'To' list, use a comma seperated list: e.g. $to = "tony@domain.com, bob@home.org, eve@yak.net"; if you want to cc the email then add it to your headers: e.g. $mailheaders .= "Cc: someone@carboncopy.com\r\n"; HTH, D. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-=- Mike Flynn - Burlington, VT -=-mike@mikeflynn.net http://www.mikeflynn.net/ * Give blood * ...maintaining lawns, watching televised sports, birthing children, listening to Top 40 music, and collecting stuffed animals...