1

ユーザー情報を連絡先フォームから自分のメールアドレスに送信するためのこのphpコードがありますが、ユーザーがフォームに記入したときに確認メールをユーザーに送信する方法がわかりません。

<?      
 $name = $_REQUEST['name'] ; 

 $company = $_REQUEST['company'] ;

 $areacode_telephone = $_REQUEST['areacode_telephone'] ;

 $telephone = $_REQUEST['telephone'] ;

 $email = $_REQUEST['email'] ;

 $notes = $_REQUEST['notes'] ;

 $body =        " Name: ".$name."\n

                 Company: ".$company."\n

                 Area Code: ".$areacode_telephone."\n 

                 Telephone: ".$telephone."\n 

                 Email Address: ".$email."\n

                 Notes: ".$notes;

     mail( "info@axsiom.com.au", "Axsiom: Contact Us", $body, "From: $email" );

         ?>
4

2 に答える 2

0

電子メールを送信するには:

require 'PHPMailerAutoload.php';

$mail = new PHPMailer;


$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@gmail.com';                 // Your gmail username
$mail->Password = 'your_gmail_password';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->From = 'from@example.com'; // from email address
$mail->FromName = 'User1'; // whatever is the name of sender
$mail->addAddress($_POST['email'], $_POST['username']);     // Add a recipient

$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = $subject;
$mail->Body    =  $message ;

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}
?>
于 2015-10-26T10:13:42.983 に答える
0

同じ関数を使用して、同じ変数を別の組み合わせで再利用して、それらに送り返すだけです。

mail( $email, "Thank You", "We Have Recived Your Request blablabla", "From: info@axsiom.com.au" );

多田。

あなたと相手の両方に同じメッセージを送信するには、次を使用します。

<?php      
 $name = $_REQUEST['name'] ; 

 $company = $_REQUEST['company'] ;

 $areacode_telephone = $_REQUEST['areacode_telephone'] ;

 $telephone = $_REQUEST['telephone'] ;

 $email = $_REQUEST['email'] ;

 $notes = $_REQUEST['notes'] ;

 $body =        " Name: ".$name."\n

                 Company: ".$company."\n

                 Area Code: ".$areacode_telephone."\n 

                 Telephone: ".$telephone."\n 

                 Email Address: ".$email."\n

                 Notes: ".$notes;

     mail( "info@axsiom.com.au, $email", "Axsiom: Contact Us", $body, "From: $email" );

         ?>

あなたと相手の両方に別のメッセージを送信するには、次を使用します。

<?php      
 $name = $_REQUEST['name'] ; 

 $company = $_REQUEST['company'] ;

 $areacode_telephone = $_REQUEST['areacode_telephone'] ;

 $telephone = $_REQUEST['telephone'] ;

 $email = $_REQUEST['email'] ;

 $notes = $_REQUEST['notes'] ;

 $body =        " Name: ".$name."\n

                 Company: ".$company."\n

                 Area Code: ".$areacode_telephone."\n 

                 Telephone: ".$telephone."\n 

                 Email Address: ".$email."\n

                 Notes: ".$notes;

     //to you
     mail( "info@axsiom.com.au", "Axsiom: Contact Us", $body, "From: $email" );
     //to them
     mail( $email, "Thank You", "We Have Recived Your Request blablabla", "From: info@axsiom.com.au" );
         ?>
于 2012-06-26T23:00:45.697 に答える