我已经尝试了很多来自stackoverflow.com上的问题的解决方案,一切看起来都不错,但我仍然无法发送电子邮件
php.ini configuration
sendmail_path = "D:\wamp\sendmail\sendmail.exe -t -i" // i check with both double and single slashes
sendmail_path = "D:\\wamp\\sendmail\\sendmail.exe -t -i"
SMTP = localhost
smtp_port = 25 // tried with 465 port as well
php代码
$headers = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type: text/html; charset=iso-8859-1' . '\r\n';
$headers .= 'From: humaaa@outlook.com' . '\r\n';
$rs = mail('iqra@gmail.com','subject','body message',$headers);
echo ($rs) ? "Success": "Fail";
使用PHPMailer tried with phpmailer class as well.
$m = new PHPMailer();
$m->IsSMTP();
$m->Host = "my_domail.com";
$m->Port = "25";
$m->SMTPAuth = false;
$m->Username = 'humaa@my_domail.com';
$m->Username = 'xxxxxxxx';
$m->FromName = 'Huma';
$m->From = 'humaaa@outlook.com';
$m->AddAddress('iqra','iqra@gmail.com');
$m->Subject = 'This is PHPMailer test';
$m->Body = 'This is PHPMailer test here i am going to make you sure!';
$rs = $m->Send();
echo ($rs) ? "Success": "Fail";
我甚至尝试使用swift邮件程序,但仍然无法发送。我需要做什么?