繁体   English   中英

在PHP中插入HTML电子邮件模板

[英]Insert HTML Email Template in PHP

有人可以帮我了解问题所在吗。 我已经尝试过几次以使其正常运行,但是没有成功。 我正在尝试将HTML电子邮件模板插入php文件,该文件会生成自动的电子邮件响应以注册到我的网站。

这是文件:

function simplr_send_notifications($atts, $data, $passw) {
$site = get_option('siteurl');
$name = get_option('blogname');
$user_name = @$data['username'];
$email = @$data['email'];
$notify = @$atts['notify'];
$emessage = apply_filters('simplr_email_confirmation_message');
$message = <<<EOF 
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

   I cut out the bulk of the template to save space...
        </table>
    </center>
</body>
</html>
EOF;
$headers = "From: $name" . ' <' .get_option('admin_email') .'> ' ."\r\n\\";
wp_mail($notify, "A new user registered for $name", "A new user has registered for $name.\rUsername: $user_name\r Email: $email \r",$headers);
$emessage = $emessage . "\r\r---\r";
    if(!isset($data['password'])) {
        $emessage .= "You should login and change your password as soon as possible.\r\r";
    }
$emessage .= "Username: $user_name\r";
$emessage .= (isset($data['fbuser_id']))?'Registered with Facebook':"Password: $passw\rLogin: $site/wp-login.php";
wp_mail($data['email'],"$name - Registration Confirmation", $emessage, $headers);

任何帮助表示赞赏! 谢谢。

尝试这个

<?php



            $template_text=addslashes('<table background="http://www.saptatec.com/shivusapta/ram/livesearch1/kcr.gif;"><tr><tr><th background="http://www.saptatec.com/shivusapta/ram/livesearch1/kcr.gif">mail</th></tr><tr><tr><th>email</th></tr> <tr><tr><th>gmail</th></tr><tr><td><img src="http://www.saptatec.com/shivusapta/ram/livesearch1/kcr.jpg" alt="baba"" /></td> </tr></table>');

            eval("\$body=\"$template_text\";");

            $header="Content-type:text/html \r\n";
            $header.="From: From Name <noreply@yourweb.com> \r\n";

            mail("yiy143@gmail.com","Activate Your Account",$body,$header);
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM