Zimbra没有收到我用mail()函数发送的邮件 我应该怎么做才能解决这个问题?
我正在使用cpanel进行实时托管并能够将电子邮件发送给Yahoo!
我不知道php.ini所在的位置,因此如果需要解决问题,我无法更改SMTP或sendmail.ini
这是发送电子邮件的代码:
// Store Data into variable
$nama = $_POST['nama'];
$email = $_POST['email'];
$perusahaan = $_POST['perusahaan'];
$message ="nama : ".$_POST[nama]."\r\n"."E-mail : ".$_POST[email]."\r\n"."Perusahaan : ".$_POST[perusahaan]."\r\n"."Nomor Hp : ".$_POST[hp]."\r\n"."Nomor Tlp : ".$_POST[tlp]."\r\n"."Alamat 1 : ".$_POST[alamat1]."\r\n"."Alamat 2 : ".$_POST[alamat2]."\r\n"."Tipe mesin : ".$_POST[tipe]."\r\n"."pesan : ".$_POST[pesan];
$message = wordwrap($message,70);
$headers = 'From: noreply@rentalrajafotocopy.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . PHP_VERSION;
//Prepare Query to store data into database
$stmt=mysqli_prepare($con,"INSERT INTO penawaran(nama,email,perusahaan,message) VALUES(?,?,?,?)");
//Bind parameter
mysqli_stmt_bind_param($stmt,"ssss",$nama,$email,$perusahaan,$message);
//Send the e-mail
if(mail("ilham@rajafotocopy.com","Penawaran",$message,$headers)) {
echo"data berhasil di kirimkan e-mail";
} else {
echo"data tidak berhasil dikirim ke e-mail, sayang sekali";
}
//Execute Query
mysqli_stmt_execute($stmt);
}
答案 0 :(得分:0)
发送邮件测试脚本,你能试试..... sendmail配置文件:/ etc / mail / log:/ var / log / maillog
<?php
$subject = 'one more try'.rand();
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=iso-8859-1";
$headers[] = "From: test@163.cn";
$headers[] = "Subject: {$subject}";
$headers[] = "X-Mailer: PHP/".phpversion();
$ok = mail('gogiqp@163.com', $subject, 'the message', implode("\r\n",$headers));
var_dump($ok);