如何格式化php电子邮件 [英] how to format php email

查看:88
本文介绍了如何格式化php电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会让它真的很简单。我想通过php发送电子邮件。现在这里是代码。

  $ line ='\\\
';
$ a =客户电话:;
$ b =客户姓氏;
$ message = $ a。$ number。$ line。$ b。$ LastName;

$ to =togotten_tarek@yahoo.com;
$ subject =Umrah预订;
$ from = $ mailer;
$ headers =From:。从$;
mail($ to,$ subject,$ message,$ headers);

这里是输出:

 客户电话:0712345678\\\
Customer姓氏:Showkot

电子邮件没有显示发件人。它说 nobody



我希望电子邮件看起来像:


$客户姓名:Showkot

,我也想显示电子邮件来自 example@example.com

解决方案

1)将'\\\
'
更改为\\\
。特殊字符(例如 \\\
)仅在双引号字符串



2)尝试更改From:From:。或者,也许变量 $ from 没有价值。


I will make it really simple. I want to send an email by php. now here is code.

$line = '\n';
$a = "Customer Phone: ";
$b = "Customer Last Name: ";
$message = $a.$number.$line.$b.$LastName;       

$to = "forgotten_tarek@yahoo.com";
$subject = "Umrah Booking";
$from = $mailer;
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);

here is the output:

Customer Phone: 0712345678\nCustomer Last Name: Showkot

and the email is showing no sender. It says nobody.

I want the email to be look like:

Customer Phone: 0712345678
Customer Last Name: Showkot

and I also want to show that the email is from example@example.com

解决方案

1) Change '\n' to "\n". Special characters (such as \n) are interpreted only in double-quoted strings.

2) Try to change "From:" to "From: ". Or, perhaps, variable $from has no value.

这篇关于如何格式化php电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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