我收到错误消息"警告:mail(): "sendmail_from"未在php.ini或自定义中设置"From:" header missing in 'WDP'DFS'46'8'7'8'4649635878'user'sites'1400094.site'www'MFPT2016'mfpt.php on line 54"
<?php
$emailSubject = 'MFPT Submission';
$webMaster = 'todd@treble-one.com';
$Email = $_POST['Email'];
$FirstName = $_REQUEST['FirstName'];
$LastName = $_REQUEST['LastName'];
$organization = $_REQUEST['organization'];
$AddressLine2 = $_REQUEST['AddressLine2'];
$City = $_REQUEST['City'];
$StateProvince = $_REQUEST['StateProvince'];
$Country = $_REQUEST['Country'];
$ZipPostalCode = $_REQUEST['ZipPostalCode'];
$Telephone = $_REQUEST['Telephone'];
$Title = $_REQUEST['Title'];
$WrittenPaper = $_REQUEST['WrittenPaper'];
$Suggested_Conference_Session = $_REQUEST['Suggested_Conference_Session'];
$Suggested_Conference_Track_Other = $_REQUEST['Suggested_Conference_Track_Other'];
$CoAuthor = $_REQUEST['CoAuthor'];
$Abstract = $_REQUEST['Abstract'];
$body = <<<EOD
Email: $Email
FirstName: $FirstName
LastName: $LastName
organization: $organization
AddressLine1: $AddressLine1
AddressLine2: $AddressLine2
City: $City
StateProvince: $StateProvince
Country: $Country
ZipPostalCode: $ZipPostalCode
Telephone: $Telephone
Title: $Title
WrittenPaper: $WrittenPaper
Suggested_Conference_Session: $Suggested_Conference_Session
Suggested_Conference_Track_Other: $Suggested_Conference_Track_Other
CoAuthor: $CoAuthor
Abstract: $Abstract
Comments: $Comments
EOD;
$host = "mail.treble-one.com";
$username = "todd@treble-one.com";
$password = "*******";
$headers .= 'From: Your name <mfpt@mfpt.com>' . "'r'n";
$headers = "Content=type: text/html'r'n";
$headers = "CC: $Email'r'n";
//line 54
$success = mail ($webMaster, $emailSubject, $body,$headers);
print " Thank you for you inquiry we will be in touch shortly.";
?>
"
我看到的头的一个问题是,首先,您在设置之前附加到$headers,然后重新分配它两次。
$headers .= 'From: Your name <mfpt@mfpt.com>' . "'r'n";
$headers = "Content=type: text/html'r'n";
$headers = "CC: $Email'r'n";
应:$headers = 'From: Your name <mfpt@mfpt.com>' . "'r'n";
$headers .= "Content=type: text/html'r'n";
$headers .= "CC: $Email'r'n";