Re: Mail function
| From: | daniel at electroteque dot org | Date: | Tue, 27 May 2003 03:13:05 +0000 |
| Subject: | Re: Mail function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149042@lists.php.net to get a copy of this message | ||
snippet from my mailer class
function set_headers($priority=false) {
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "From: $this->sender_name <".$this-
>sender_email.">\r\n";
$headers .= "To: ".$this->rcpt_name." <".$this-
>rcpt_email.">\r\n";
$headers .= "Reply-To: ".$this->sender_name." <$this-
>sender_email>\r\n";
if ($priority) {
switch($priority) {
case '1':
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority:
High\r\n";
break;
case '2':
$headers .= "X-Priority: 2\r\n";
$headers .= "X-MSMail-Priority:
Medium\r\n";
break;
case '3':
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority:
Low\r\n";
break;
default:
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority:
Low\r\n";
break;
}
}
$headers .= "X-Mailer: PHP Mailer\r\n";
if ($this->cc) {
foreach ($this->cc as $key=>$value) {
$headers .= "Cc: ".$this->cc[$key][0]."
<".$this->cc[$key][1].">\r\n";
}
}
if ($this->bcc) {
foreach ($this->bcc as $key=>$value) {
$headers .= "Bcc: ".$this->bcc[$key][0]."
<$this->bcc[$key][1]>\r\n";
}
}
$this->mime_boundary = "MIME_BOUNDRY";
$headers.="Content-Type: multipart/mixed;boundary=\"".$this-
>mime_boundary."\"\n";
$headers .="This is a multi-part message in MIME format.\n";
return $headers;
}
basically append all the values to a header vairable
> I have change server which has new version of php requiring use of
> $_POST for form stuff.
>
> I changed a mail I did in my from to this new format
>
> mail("<fake@address.com>", "Mail from form!",
> "$_POST["first_name"]
> $_POST["last_name"]\n$_POST["address"]\n$_POST["city"]
> $_POST["state"]
>
> $_POST["zip"]\n$_POST["country"]\n$_POST["email"]\n$_POST["design"]
\n$_POST[
> "comments"]",
> "From: $_POST["first_name"] $_POST["last_name"]
> <$_POST["email"]>\nReply-To: $_POST["email"]\nX-Mailer: PHP/" .
> phpversion());
>
>
> PHP totally chokes on this, the page doesn't even show. I am sure I
> doing something wrong could you tell me what it is.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php