Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在HTML中使用PHP处理电子邮件文件_Php_Html - Fatal编程技术网

在HTML中使用PHP处理电子邮件文件

在HTML中使用PHP处理电子邮件文件,php,html,Php,Html,我在html表单中使用php时遇到问题。虽然它会发送,但当我试图在php文件中获取$u POST变量时,它们是空的。你知道我做错了什么吗 我的HTML代码: 提交消息: 名称: 电子邮件地址: 信息: 您应该使用邮件标题功能。在代码中也添加以下代码 $header = "From:abc@somedomain.com \r\n"; $header .= "Cc:afgh@somedomain.com \r\n"; $header .= "MIME-Version: 1.0\r\n";

我在html表单中使用php时遇到问题。虽然它会发送,但当我试图在php文件中获取$u POST变量时,它们是空的。你知道我做错了什么吗

我的HTML代码:

提交消息:
名称:

电子邮件地址:

信息:

您应该使用邮件标题功能。在代码中也添加以下代码

 $header = "From:abc@somedomain.com \r\n";
 $header .= "Cc:afgh@somedomain.com \r\n";
 $header .= "MIME-Version: 1.0\r\n";
 $header .= "Content-type: text/html\r\n";

mail($emailadd, $subject, $text.$name.$line.$email.$line.$message,$header, 'From: '.$emailfrom.'');

祝你好运。

你应该使用邮件标题功能。在代码中也添加以下代码

 $header = "From:abc@somedomain.com \r\n";
 $header .= "Cc:afgh@somedomain.com \r\n";
 $header .= "MIME-Version: 1.0\r\n";
 $header .= "Content-type: text/html\r\n";

mail($emailadd, $subject, $text.$name.$line.$email.$line.$message,$header, 'From: '.$emailfrom.'');

祝您好运。

您需要将标题传递到邮件功能中,该功能是可选的

下面是所有参数的函数

bool-mail(string$to、string$subject、string$message[、string$additional\u headers[、string$additional\u parameters]])

$to收件人,或邮件的收件人

$subject要发送的电子邮件的主题

$message要发送的消息

$additional_Header这是用于邮件选项的可选标题

您可以在标题中设置以下值

// header configuration for to send the HTML mail
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
//用于发送HTML邮件的标头配置
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=iso-8859-1'。“\r\n”;
//附加标题
$headers.='To:Mary,Kelly'。“\r\n”;
$headers.=“发件人:生日提醒”。“\r\n”;
$headers.='Cc:birthdayarchive@example.com' . “\r\n”;
$headers.='密件抄送:birthdaycheck@example.com' . “\r\n”;
$additional_parametersadditional_parameters参数可用于将附加标志作为命令行选项传递给配置为在发送邮件时使用的程序


您需要将标题传递到mail函数中,该函数是可选的

下面是所有参数的函数

bool-mail(string$to、string$subject、string$message[、string$additional\u headers[、string$additional\u parameters]])

$to收件人,或邮件的收件人

$subject要发送的电子邮件的主题

$message要发送的消息

$additional_Header这是用于邮件选项的可选标题

您可以在标题中设置以下值

// header configuration for to send the HTML mail
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
//用于发送HTML邮件的标头配置
$headers='MIME版本:1.0'。“\r\n”;
$headers.='内容类型:文本/html;字符集=iso-8859-1'。“\r\n”;
//附加标题
$headers.='To:Mary,Kelly'。“\r\n”;
$headers.=“发件人:生日提醒”。“\r\n”;
$headers.='Cc:birthdayarchive@example.com' . “\r\n”;
$headers.='密件抄送:birthdaycheck@example.com' . “\r\n”;
$additional_parametersadditional_parameters参数可用于将附加标志作为命令行选项传递给配置为在发送邮件时使用的程序


使用PHPMail或Rmail之类的框架/库。您必须发送正确的标题才能将其视为html,这是手动操作的一大难题。这意味着如果这是在windows计算机上编写的(“\r\n”),则可能会混合行尾(“\r\n”)您有
$line='
$text=“blah\n”尝试
$line=“\n”
。如果不是这样的话,那么电子邮件和消息都是空的……使用PHPMail或Rmail之类的框架/库。您必须发送正确的标题才能将其视为html,这是手动操作的一大难题。这意味着如果这是在windows计算机上编写的(“\r\n”),则可能会混合行尾(“\r\n”)您有
$line='
$text=“blah\n”尝试
$line=“\n”
。如果不是这样,那么电子邮件和消息都是空的。。。。