htmlファイル内にhtmlメールを実装しました。そして、私はPHPMailer
クラスを使用して電子メールを送信するphpファイルを持っています。私が達成したいのは、HTML内にテキストがあり、誰にメールを送信するかによって変更する必要があるということです。
これはメールを送信するphpファイルです
<?php
// get variables
$contact_name = addslashes($_GET['contact_name']);
$contact_phone = addslashes($_GET['contact_phone']);
$contact_email = addslashes($_GET['contact_email']);
$contact_message = addslashes($_GET['contact_message']);
// send mail
require("class.phpmailer.php");
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'ssl://smtp.gmail.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'danyel.p@gmail.com';
$mailer->Password = 'mypass';
$mailer->From = 'contact_email';
$mailer->FromName = 'PS Contact';
$mailer->Subject = $contact_name;
$mailer->AddAddress('pdaniel@gmail.com');
$mailer->Body = $contact_message;
if($mailer->Send())
echo 'ok';
?>
そして、テーブルとそれに必要なすべての標準で実装された単純なhtmlメールを含むhtmlファイル。
これを達成するための最良のアプローチである私のよりも勇敢な心に尋ねたいと思います。:)
ダニエル、よろしくお願いします!
編集:今、$ mailer-> Bodyに$contact_message変数をテキストメールとして持っていますが、その本文にhtmlメールを含むhtmlファイルをロードしたいのですが、どういうわけかhtmlの本文を変更したいですこの$contact_message変数内にテキストを含む電子メール。