我在html文件里实现了一个html邮件。我有一个使用PHPMailer
类发送电子邮件的PHP文件。 我想实现的是,我应该改变的HTML内的一些文本取决于我发送电子邮件的人。在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 = '[email protected]';
$mailer->Password = 'mypass';
$mailer->From = 'contact_email';
$mailer->FromName = 'PS Contact';
$mailer->Subject = $contact_name;
$mailer->AddAddress('[email protected]');
$mailer->Body = $contact_message;
if($mailer->Send())
echo 'ok';
?>
和包含有桌子和所有标准的它需要实现一个简单的HTML邮件的HTML文件。
我想问勇敢的头脑比我这是实现这一目标的最佳途径。 :)
谢谢你在前进, 牛!
编辑:现在,在$ mailer->身体我有$ contact_message变量作为文本电子邮件..但我想在该机构加载一个HTML文件包含一个HTML电子邮件,我想以某种方式更改这个$ contact_message变量中的文本的html电子邮件正文。
澄清你的问题。 – 2012-07-24 18:42:41