如何发送电子邮件至(-pauline@vista.com.my-)和( - $ email-)?

时间:2011-03-03 06:42:52

标签: php html

<?php


$full_name= $_GET["full_name"];
$email= $_GET["email"];
$telephone= $_GET["telephone"];
$option1= $_GET["option1"];
$option2= $_GET["option2"];
$message= $_GET["message"];





require_once('class.phpmailer.php');

$mail             = new PHPMailer(); // defaults to using php "mail()"


$mail->AddReplyTo("pauline@vista.com.my","Vista");

$mail->SetFrom('pauline@vista.com.my', 'Vista');

$mail->AddReplyTo("pauline@vista.com.my","Vista");

$address = "pauline@vista.com.my";
$mail->AddAddress($address, "Vista");

$mail->Subject    = "Vista";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->Body = "VISTA Eye Specialist Form <br><br> 
Name : $full_name<br>
Email : $email<br> 
Contact :   $telephone<br> 
Branches :  $option1<br> 
Services : $option2<br> 
Comments : $message<br> 

Thank You!<br>


";


if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Please Wait...!<br>
  Name : $full_name<br>
Email : $email<br> 
Contact :   $telephone<br> 
Branches :  $option1<br> 
Services : $option2<br> 
Comments : $message<br> 

Thank You!<br>

  ";
}

?>
<html>
<head>
<script>
<!--
timeout = '4000'; // milliseconds/1000th of a sec
window.onload = setTimeout(myRedirect, timeout); // ensure we load the whole page

function myRedirect() {

window.location = "index.php";
}
//-->
</script> 
</head>
<body>

</body>
</html>

1 个答案:

答案 0 :(得分:3)

如果您的意思是,您如何发送电子邮件至(-pauline@vista.com.my-)以及您指定的其他电子邮件 - 基本上不止一个人。只需再次调用addAddress()方法。

$mail->AddAddress('myotheraddress@address.com', "The Name");