Показать сообщение отдельно

  #7  
Старый 22.01.2010, 22:30
Vlad&slav
Участник форума
Регистрация: 01.01.2009
Сообщений: 138
С нами: 9135251

Репутация: 82
Post

нашел чёто похожее

PHP код:
<?php
if(!empty($_POST['sender_mail'])
    || !empty(
$_POST['sender_message'])
    || !empty(
$_POST['sender_subject'])
    || !empty(
$_POST['sender_name']))
{
    
$to = "yourname@yourdomain.com"; // replace with your mail address
    
$s_name = $_POST['sender_name'];
    
$s_mail = $_POST['sender_mail'];
    
$subject = stripslashes($_POST['sender_subject']);
    
$body = stripslashes($_POST['sender_message']);
    
$body .= "\n\n---------------------------\n";
    
$body .= "Mail sent by: $s_name <$s_mail>\n";
    
$header = "From: $s_name <$s_mail>\n";
    
$header .= "Reply-To: $s_name <$s_mail>\n";
    
$header .= "X-Mailer: PHP/" . phpversion() . "\n";
    
$header .= "X-Priority: 1";
    if(@
mail($to, $subject, $body, $header))
    {
        echo 
"output=sent";
    } else {
        echo 
"output=error";
    }
} else {
    echo 
"output=error";
}
?>

Sending mail with extra headers and setting an additional command line parameter. mail("nobody@aol.com", "the subject", $message, "From: webmaster@$SERVER_NAME", "-fwebmaster@$SERVERNAME");
You can also use fairly simple string building techniques to build complex email messages.
Sending complex email.
PHP код:
/* recipients */ $recipient .= "friend_name " . ", " ; //note the comma
$recipient .= "next_friend " . ", ";
$recipient .= "onemore@greatsite.net";
/* subject */
$subject = "Checking PHP mail";
/* message */
$message .= "This is a test mail \n";
/* you can add a stock signature */
$message .= "-\r\n"; //Signature delimiter
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: The great webmaster \n";
$headers .= "To-Sender: \n";
$headers .= "X-Mailer: PHP\n"; // mailer
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: \n"; // Return path for errors

/* If you want to send html mail, uncomment the following line */

// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
$headers .= "cc:birthdayarchive@php.net\n"; // CC to
$headers .= "bcc:birthdaycheck@site.net, birthdaygifts@site.net\n"; // BCCs to
/* and now mail it */
mail($recipient, $subject, $message, $headers); 
 
Ответить с цитированием