我想在2个不同的人发送2个不同的电子邮件发送消息'按钮。我对此几乎没有任何疑问。
是否可以从同一页面发送多封电子邮件。
我编写了以下代码,但它没有发送任何电子邮件并返回错误消息。
<?php include 'connect.php'; $subject = $_REQUEST['subject'] ; // Subject of your email $personal_email= "abc@hotmail.com"; $message .= 'Name: ' . $_REQUEST['name'] . "<br>"; $message .= $_REQUEST['product_type']. "<br>"; $message .= $_REQUEST['message']; $subject_to_sender= "Confirmation"; $message_to_sender = "Thanks for contacting us, Our representative will contact you shortly."; $name= mysql_real_escape_string($_REQUEST['name']); $email= mysql_real_escape_string($_REQUEST['email']); $message= mysql_real_escape_string($_REQUEST['message']); $product_type= mysql_real_escape_string($_REQUEST['product_type']); $address= mysql_real_escape_string($_REQUEST['address']); if($address== "") { $address= "No Address is given."; } $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= "From: " . $_REQUEST['email'] . "\r\n"; // Sender's E-mail $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; if (@mail($email, $subject_to_sender, $message_to_sender, $headers)) { mail($personal_email, $subject, $message, $headers); // Transfer the value 'sent' to ajax function for showing success message. echo 'sent';