2017-02-01 5 views
-4

私はユーザーの支払いが完了した後に支払いゲートウェイで作業していますが、確認メッセージが表示された成功ページにユーザーを送ります。メールでお返事をお送りください

今、この謝辞をユーザーメールに送信して、ユーザーがemail.Soからダウンロードできるようにしたいと思います。どのようにすればよいのでしょうか。

おかげ

次のように、HTML形式の電子メールを送信するためにPHPを取得することができます

あなたが注文を確認ページを表示するだけでなく、ユーザーに電子メールを送信するためにPHPを取得することができます

+0

だから、ブラウザに表示されているページのPDFを送信しますか? http://phantomjs.org/screen-capture.htmlまたは、PHPでPDFファイルを作成して電子メールで送付しますか? https://tcpdf.org/ –

+0

はい、別の場所への支払い完了後にユーザーが表示する必要があります。 –

+0

どういう意味ですか? –

答えて

4

、:

$to  = $email; 
$subject = 'Order Confirmed'; 
$message = '<html>This is an email to confirm that '.$OrderID.' has been acknowledged.</html>'; 

// To send HTML mail, the Content-type header must be set 
$headers = 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 

// Additional headers 
$headers .= 'From: Website <[email protected]>' . "\r\n"; 

mail($to, $subject, $message, $headers); 

PDFドキュメントを添付するには、FPDFで生成するのが最善の方法です。 自動的に送信される電子メールにPDFを添付することができます。

$to  = $email; 
$subject = 'Order Confirmed'; 
$message = '<html>This is an email to confirm that '.$OrderID.' has been acknowledged.</html>'; 

// attachment name 
$InvoiceFilename = "Invoice$OrderID.pdf"; 

// encode data (puts attachment in proper format) 
$pdfdoc = $pdf->Output("", "S"); 
$pdf->Output(F,'../uploads/Invoice'.$OrderID.'.pdf'); 

//$pdf->Output(); 
$attachment = chunk_split(base64_encode($pdfdoc)); 

// main header 
$headers = "From: ".$from.$eol; 
$headers .= "MIME-Version: 1.0".$eol; 
$headers .= "Content-Type: multipart/mixed; boundary=\"".$separator."\""; 

// no more headers after this, we start the body! // 

$body = "--".$separator.$eol; 
$body .= "Content-Transfer-Encoding: 7bit".$eol.$eol; 
$body .= "This is a MIME encoded message.".$eol; 

// message 
$body .= "--".$separator.$eol; 
$body .= "Content-Type: text/html; charset=\"iso-8859-1\"".$eol; 
$body .= "Content-Transfer-Encoding: 8bit".$eol.$eol; 
$body .= $message.$eol; 

// attachment 
$body .= "--".$separator.$eol; 
$body .= "Content-Type: application/octet-stream; name=\"".$InvoiceFilename."\"".$eol; 
$body .= "Content-Transfer-Encoding: base64".$eol; 
$body .= "Content-Disposition: attachment".$eol.$eol; 
$body .= $attachment.$eol; 
$body .= "--".$separator."--"; 

// send message 
mail($to, $subject, $body, $headers); 
+0

ありがとう、私はそれについて知っていると私はユーザーに確認メールを送信しています。しかし、私はpdfを作成して、ユーザーがそれをダウンロードできるようにしたいと思います。 –

+0

ああ、あなたはそれについて言及しなかった。私はそれを更新した、PHP PDFジェネレータであるFPDFを使用して、それを添付することができます。 –

関連する問題