Re: two small issues with php mail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stut wrote:
Brad wrote:
<?

$email = $_REQUEST['email'];

$fromaddress = 'admin@xxxxxxxxxxxxxxxxxxxxx';

$fromname = 'Zone of success Club'; $eol = "\r\n";

$headers  = 'From: '.$fromname.' <'.$fromaddress.'>'.$eol;

// $headers = 'bcc: 'kathyandrews@xxxxxxxxxxxxx';

$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@xxxxxxxxxxx';
  // 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@xxxxxxxxxxx>'.$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


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.


--
Jim Lucas


    "Perseverance is not a long race;
        it is many short races one after the other"

Walter Elliot



    "Some men are born to greatness, some achieve greatness,
        and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux