如何在MySQLi或PDO中发送电子邮件?

时间:2016-06-22 11:26:58

标签: php

我无法理解如何在MySQLi PHP或PDO中使用电子邮件功能。 所以请帮帮我 我的代码:

$to = "xyz@gmail.com"; 
$from = $_REQUEST['email'];
$subject = "Client Contact Detail";
$subject2 = "Company  reply";
$message = 'Hello We are here';
$message2 = 'Our Details';
$headers = "From:" . $from;
$headers  .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers2 = "From:" . $to; 
$headers2  .= 'MIME-Version: 1.0' . "\r\n"; 
$headers2 .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";   
 //echo "<pre>";
 //print_r($message)."<br/>";
 //print_r($message2);
 //exit;
@mail($to,$subject,$message,$headers);
@mail($from,$subject2,$message2,$headers2); // sends a copy of the message to the sender
      header('location:index.php');

0 个答案:

没有答案