【发布时间】:2020-08-16 19:47:20
【问题描述】:
我的问题是,当您注册用户时,会生成发送到电子邮件的随机代码,我为包含基本文本和样式的电子邮件创建了一个模板,此电子邮件仅更改带有生成代码的基本链接。所以一切都应该按我的意思工作,但目前在注册期间会收到电子邮件,但没有我提供的样式。代码如下。
$to = $email;
$subject = "Registration Confirmation";
$link = "<a href='".DIR."/activation?x=$latest_id&y=$activasion'>".DIR."/activation?x=$latest_id&y=$activasion</a>";
$headers = "MIME-Version: 1.0" . "\r";
$headers .= "Content-Type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: '.$from."\r\n".
'Reply-To: '.$from."\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = file_get_contents("inc/user_register.html");
$message = str_replace('[link]', $link, $message);
mail($to, $subject, $message, $headers);
header("location: /login?action=joined");
【问题讨论】:
标签: php mysql email html-email