Sam Laundon Posted January 5, 2006 Posted January 5, 2006 I was hoping someone could tell me how to include a cc email in the following code from FmWebSchool: <? $mailto = '[email protected]' ; $subject = "Feedback Form" ; $formurl = "http://www.yourwebsite.net/page1.htm" ; $errorurl = "http://www.yourwebsite.net/emailerror.htm" ; $thankyouurl = "http://www.yourwebsite.net/emailcomplete.htm" ; $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $email = $_POST['email'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } $messagetext =" nn"."firstname=".$firstname ."nlastname=".$lastname."nemail=".$email."nn n" ; mail($mailto, $subject, $messagetext, "From: "$name" <$email>nReply-To: "$name" <$email>nX-Mailer: chfeedback.php 2.01" ); header( "Location: $thankyouurl" ); exit ; ?> Thanks in advance for your help - Sam
Garry Claridge Posted January 5, 2006 Posted January 5, 2006 Try this: mail($mailto, $subject, $messagetext, "From: "$name" <$email>nReply-To: "$name" <$email> nCc: [email protected] nX-Mailer: chfeedback.php 2.01:" ); Good Luck. Garry
Sam Laundon Posted January 5, 2006 Author Posted January 5, 2006 Thanks Garry, You code works great. I just realized that I wanted a blind cc. Do you have the code for that. You always are a great help - Thank you - Sam
Garry Claridge Posted January 5, 2006 Posted January 5, 2006 I think it is just: nBcc: [email protected] Good Luck. Garry p.s. You will find information about the PHP mail() function here: http://au3.php.net/manual/en/function.mail.php
mlindal Posted January 11, 2006 Posted January 11, 2006 Gary, I have the following universal email script, but for some reason the 'Cc' doesn't work. The headers print out as if the 'Cc' should be working, but no 'Cc' is ever received. Any thoughts on what might be missing? function sendEmailWithSockets ($toName, $toEmail, $subject, $message) { global $SMTPServer, $SMTPPort, $emailFromName, $emailFromAddr, $contactEmailAddr; $connect = fsockopen($SMTPServer, $SMTPPort, $errno, $errstr, 30) or die("$errno: $errstr"); $rcv = fgets($connect, 1024); fputs($connect, "HELO {$_SERVER['SERVER_NAME']}rn"); $rcv = fgets($connect, 1024); fputs($connect, "MAIL FROM:{$emailFromAddr}rn"); $rcv = fgets($connect, 1024); fputs($connect, "RCPT TO:{$toEmail}rn"); $rcv = fgets($connect, 1024); fputs($connect, "DATArn"); $rcv = fgets($connect, 1024); fputs($connect, "Subject: $subjectrn"); fputs($connect, "From: {$emailFromName} <{$emailFromAddr}>rn"); fputs($connect, "To: {$toName} <{$toEmail}>rn"); fputs($connect, "Cc: Mark Lindal rn"); fputs($connect, "X-Sender: <{$emailFromAddr}>rn"); fputs($connect, "Return-Path: <{$emailFromAddr}>rn"); fputs($connect, "Errors-To: <{$emailFromAddr}>rn"); fputs($connect, "X-Mailer: PHPrn"); fputs($connect, "X-Priority: 3rn"); fputs($connect, "Content-Type: text/html; charset=utf-8rn"); fputs($connect, "rn"); fputs($connect, stripslashes($message)." rn"); fputs($connect, ".rn"); $rcv = fgets($connect, 1024); fputs($connect, "RSETrn"); $rcv = fgets($connect, 1024); fputs ($connect, "QUITrn"); $rcv = fgets ($connect, 1024); fclose($connect); }
Garry Claridge Posted January 11, 2006 Posted January 11, 2006 I've never used the sockets method, I just use the mail() function. However, try this line: fputs($connect, "Cc: [email protected]"); I took out the name and the <>. Good Luck. Garry
mlindal Posted January 12, 2006 Posted January 12, 2006 Interesting. The headers display correctly, but still no CC'd email is received. When I take the message and do a reply-all, the cc'd address is mysteriously dropped. I think I read somewhere (php.net) where the windows version was having problems with cc and bcc.
Recommended Posts
This topic is 6959 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now