简体   繁体   English

我正在尝试使用PHP从FORM发送电子邮件,但是我收到的详细信息没有发件人电子邮件地址

[英]I am trying to send email from a FORM using PHP, but i receive the details without the From email Address

I am trying to send email from a FORM, but i receive the details without the FROM email Address, help to rectify the issue. 我正在尝试从FORM发送电子邮件,但是我收到的详细信息没有FROM电子邮件地址,有助于纠正此问题。

/* HTML FORM CODE */

<form action="contact.php" method="post">
Name:<br><input type="text" name="name"><br>
From:<br><input type="text" name"from"><br>
Request:<br><textarea type="text" name="request"></textarea><br>
<input type="submit" name="submit" value="send">
</form>
/* HTML FORM CODE */

/* PHP SEND EMAIL CODE */
<?php
$name=$_POST['name'];
$from=$_POST['from'];
$request=$_POST['request'];

$to="skks1981@gmail.com";
$subject=$request;
$body=<<<EMAIL
Hai My name is $name

My email is $from

$request

EMAIL;
$header:$from;
mail($to,$subject,$body,$header);
echo "Message Sent";
?>

/* PHP SEND EMAIL CODE */

Note: In From part i receive unknown or admin@khatamband.com email address. 注意:在“发件人”中,我收到未知或admin@khatamband.com电子邮件地址。

Thank in advance. 预先感谢。

You should use this $header: 您应该使用此$ header:

$header = "From: {$from}";

and not 并不是

$header:$from;

暂无
暂无

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

相关问题 填写php表单发生错误时,我正尝试向自己发送电子邮件 - I am trying to send an email to myself when an error happens from filling out the php form 我正在尝试通过 php 从我的联系我们页面向 email 发送 email 但它给出了错误我的代码和错误如下 - i am trying to send an email from my contact us page to email by php but it gives error my code and error given below 使用 Z2FEC392304A5C23AC13ZZDA22847F9B7 从 MySQL 将 email 发送到所有 email 地址 - Send email to all email address from MySQL using PHP 我想通过电子邮件发送此表格的详细信息, - I want to send the details of this form as an email, 我正在尝试使用 php 从 html 输入到 mysql 获取单个值(电子邮件地址) - I'm trying to get a single value (an email address) from a html input to mysql using php 如何从PHP表单发送带有附件的电子邮件? - How can I send an email with attachments from a PHP form? 为什么我可以使用Swift Mailer从本地主机发送电子邮件,而不能使用PHP的mail()函数发送电子邮件? - Why am i able to send email from localhost using Swift Mailer but not with PHP's mail() function? 我正在尝试使用codeigniter从cPanel发送电子邮件,但每次收到错误消息时都说连接超时 - I am trying to send email from cPanel using codeigniter but every time I get the error saying connection time out 我可以使用PHP从表单发送数据并选择下拉列表发送电子邮件吗? - Can i send data from a form and select drop down to email using PHP? 尝试将表单中的复选框值发送到PHP中的电子邮件 - Trying to send checkbox value(s) from form to email in PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM