Re: two small issues with php mail
| From: | Stut | Date: | Tue, 20 Nov 2007 14:59:03 +0000 |
| Subject: | Re: two small issues with php mail | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-264864@lists.php.net to get a copy of this message | ||
Jim Lucas wrote:
Stut wrote:Point me to the message where Brad mentions SMTP auth. I can't find it. Looking back at the thread you were the first person to mention SMTP auth. Brad talked about SMTP (clearly not understanding what it is) - you added the auth. Let's not go over-complicating the issue, the guy is already having some serious problems. -Stut -- http://stut.net/Brad wrote:You forgot the second part of the project, SMTP auth. Can't do it this way. Have to use fsockopen() or something to talk directly to the SMTP server.<? $email = $_REQUEST['email']; $fromaddress = 'admin@zoneofsuccessclub.com'; $fromname = 'Zone of success Club'; $eol = "\r\n"; $headers = 'From: '.$fromname.' <'.$fromaddress.'>'.$eol; // $headers = 'bcc: 'kathyandrews@bellsouth.net'; $headers .= 'Reply-To: '.$fromname.' <'.$fromaddress.'>'.$eol; $headers .= 'Return-Path: '.$fromname.' <'.$fromaddress.'>'.$eol; $headers .= 'X-Mailer: PHP '.phpversion().$eol; $headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol; $headers .= 'Content-Transfer-Encoding: 8bit'; $subject = 'Your free book!'; $body = '<a href="http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf">"Click ME"</a> Here is your FREE autopilot book!!!!'; mail($email, $subject, $body, $headers); ?>Take this, be grateful and feel free to try Ruby. Email addresses have been changed to protect your victims. <?php // You REALLY REALLY need to be doing some validation on this variable $email = $_REQUEST['email']; // This is the address the email will appear to come from $fromaddress = 'fromaddress@example.com'; // And this is the name $fromname = 'Zone of success Club'; // This is the header separator, it *does* need the \r $eol = "\r\n"; // Now we start building the headers, starting with from $headers = 'From: '.$fromname.' <'.$fromaddress.'>'.$eol; // Then we *concatenate* the next header to $headers $headers .= 'bcc: <hiddenrecipient@example.com>'.$eol; // Some more headers, some pointless but I can't be arsed to argue $headers .= 'Reply-To: '.$fromname.' <'.$fromaddress.'>'.$eol; // Removed the name on this one - it's not supposed to have one $headers .= 'Return-Path: <'.$fromaddress.'>'.$eol; $headers .= 'X-Mailer: PHP '.phpversion().$eol; $headers .= 'Content-Type: text/html; charset=iso-8859-1'.$eol; $headers .= 'Content-Transfer-Encoding: 8bit'; $subject = 'Your free book!'; $body = '<a href="http://www.zoneofsuccessclub.com/freePDF/autopilotebook.pdf">"Click ME"</a> Here is your FREE autopilot book!!!!'; mail($email, $subject, $body, $headers); ?> I've tested this on a pretty standard install of PHP 5.1.1, and it works, bcc and all. -Stut