2016-05-30 14 views
0
 if($_POST['mail']) 
    { 
$to_name = $rows['username']; 
$to = $rows['email']; 
$subject = "Invoice"; 



    $from_name = "abc.com"; 
$from = "[email protected]"; 

// phpMailer 
require_once('phpmailer/PHPMailerAutoload.php'); 
$mail = new PHPMailer(); 

$mail->IsSMTP(); 
$mail->Host = "smtp.gmail.com"; //enable php socks to make SSL it working 
$mail->Port = 465; 
$mail->SMTPAuth = true; 
$mail->SMTPSecure = 'ssl';  
$mail->Username = "[email protected]"; 
$mail->Password = "password"; 

$mail->FromName = $from_name; 
$mail->From = $from; 
$mail->AddAddress($to, $to_name); 
$mail->Subject = $subject; 
$mail->Body = include'invoice.php'; 
$mail->IsHTML(true);  
$result = $mail->Send(); 
} 
?> 

私はPHPのページを表示して、メールに何も表示しません!phpメーラー本体に外部のphpファイルを含めて

+0

新しい問題を含めるようにあなたの質問を編集しないでください。代わりに、新しい質問を作成します。 – Matt

答えて

3

これは、これを行うには正しい方法です:

ob_start(); 
include('invoice.php'); 
$mail->Body = ob_get_contents(); 
ob_end_clean(); 
関連する問題