我收到错误消息“警告:mail():”sendmail_from“未在php.ini中设置或自定义”来自:\ WDP \ DFS \ 46 \ 8 \ 7 \ 8 \ 4649635878 \ user中缺少标题第54行上的\ sites \ 1400094.site \ www \ MFPT2016 \ mfpt.php“
<?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.";
?>
`
答案 0 :(得分:0)
我看到标题的一个问题是,首先,在设置之前附加到$标头,然后重新分配两次。
$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";