通过Mail()函数中的HTML电子邮件传递PHP变量 [英] Passing a PHP Variable through a HTML email in the Mail() function

查看:102
本文介绍了通过Mail()函数中的HTML电子邮件传递PHP变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在运行一个小脚本,该脚本应该向用户发送电子邮件,告诉他们他们的新密码是什么.

我有我的变量:

Hello everybody,
I''m running a small script that should send the user an email, telling them what their new password is.

I have my variable:

$newPassword


我有我的HTML电子邮件:


And I have my HTML Email:

<html>
<body>
    <div class='container'>
        <img src='images/logos/small_logo.png' />
        <h4>Your password has been reset to the following:</h4>
        <p>" . $newPassword . "</p>
    </div>
</body>
</html>


我正在尝试在电子邮件的html段落标记中传递变量,但输出为空白.

有什么建议吗?

问候,
Tom.


I''m trying to pass the variable through in the html paragraph tags in my email, but the output is blank.

Any suggestions?

Regards,
Tom.

推荐答案

newPassword
newPassword


我有我的HTML电子邮件:


And I have my HTML Email:

<html>
<body>
    <div class='container'>
        <img src='images/logos/small_logo.png' />
        <h4>Your password has been reset to the following:</h4>
        <p>" .


newPassword."/p < /div > < /body > < /html >
newPassword . "</p> </div> </body> </html>


我正在尝试在电子邮件的html段落标记中传递变量,但输出为空白.

有什么建议吗?

问候,
汤姆.


I''m trying to pass the variable through in the html paragraph tags in my email, but the output is blank.

Any suggestions?

Regards,
Tom.


我将自己张贴这个问题,以结束问题,尽管功劳应该归功于enhzflep,因为他是第一个回答的人.出于礼貌,我将对您在问题与解答"中找到的前5个答案进行投票,前提是它们已经被接受或投票.
另外,如果您决定自己发布解决方案,请这样说,我将删除我的

解决方案:
替换此行< p>.
I will post this myself, to close the question, although the credit should go to enhzflep, as he has been the first to answer. As a courtesy, I will upvote your first 5 answers I find in Q&A, provided they have been accepted or upvoted already.
Also, should you decide to post the solution yourself, just say so and I will delete mine

Solution:
Replace this line <p>" .


这篇关于通过Mail()函数中的HTML电子邮件传递PHP变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆