我想在php邮件发送功能上更改我的电子邮件标题,但我不能这样做,我尝试将此用于我的php.ini
std::async
但它不起作用,我使用plesk。
然后我尝试更改我的PHP脚本并将标题参数添加到我的PHP代码[我是新的PHP并使用某人在互联网上的脚本]但它不工作,我的意思是邮件没有发送..
php发送邮件脚本,没有任何更改正常工作并发送电子邮件
sendmail_path = /usr/sbin/sendmail -t -i -f'user@domain.com'
但是当我在我的代码中添加headers参数时,邮件没有发送
<?php
$emailTo = "user@domain.com";//change this to the email address which should receive the form data
/*
NOTE: do not change anything below this
*/
if( isset($_POST['maximus']) ) {
//honey pot detection
if( $_POST['maximus'] != '' ) {
die('Bad spam bot!!');
}
$message = "";
foreach( $_POST as $field => $val ) {
if( $field != 'maximus' ) {
$message .= $field . " : ". $val . "\n";
}
}
$subject = $_POST['theSubject'];
//send the email
if( mail($emailTo, $subject, $message) ) {
echo "Message sent!";
} else {
echo "Could not send message";
}
}
?>
html表格:
<?php
$emailTo = "user@domain.com";//change this to the email address which should receive the form data
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <webmaster@example.com>' . "\r\n";
/*
NOTE: do not change anything below this
*/
if( isset($_POST['maximus']) ) {
//honey pot detection
if( $_POST['maximus'] != '' ) {
die('Bad spam bot!!');
}
$message = "";
// Always set content-type when sending HTML email
foreach( $_POST as $field => $val ) {
if( $field != 'maximus' ) {
$message .= $field . " : ". $val . "\n";
}
}
$subject = $_POST['theSubject'];
//send the email
if( mail($emailTo, $subject, $message, $headers) ) {
echo "Message sent!";
} else {
echo "Could not send message";
}
}
?>
我看到代码的这一部分注意:请勿在此下更改任何内容,但我确实需要更改我的标题名称..