PHP发送邮件多个正文字段 [英] php send mail multiple body fields
本文介绍了PHP发送邮件多个正文字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有问题,想使用php发送电子邮件,一切都可以通过此代码很好地完成
Hello,
I have a problem, want to send an email with php everything is send fine with this code
<?php
$mail = $_POST['mail'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$to = "filippos8@otenet.gr";
$message =" You received a mail from ".$mail;
$message .=" Text of the message : ".$text;
if(mail($to, $subject,$message)){
echo "mail successful send";
}
else{
echo "there's some errors to send the mail, verify your server options";
}
?>
但是我也想在消息中发送变量$ name文本,如何将该变量添加到$ message?
此代码仅发送$ name和文本$ message
but I want to send the variable $name text too in the message, how can I add this variable to $message?
this code sends only the $name and the text $message
<?php
$mail = $_POST['mail'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$to = "filippos8@otenet.gr";
$message =" You received a mail from ".$mail;
$message =" You received a mail from ".$name;
$message .=" Text of the message : ".$text;
if(mail($to, $subject,$message)){
echo "mail successful send";
}
else{
echo "there's some errors to send the mail, verify your server options";
}
?>
,两种情况下的主题均正确发送.我是php的新手.
谢谢
Kyriakos
, the subject both cases send correctly. I am a newbie in php.
Thank you
Kyriakos
推荐答案
mail =
mail =
_POST [' span> 邮件'];
_POST['mail'];
名称 =
name =
这篇关于PHP发送邮件多个正文字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文