繁体   English   中英

无法使用php中的邮件功能发送邮件

[英]Not able to send mail using mail function in php

任何人都可以帮助我解决我的问题。.我无法使用php中的mail()发送邮件。这是我的代码:

if (isset($_POST["from"])) {
    $from = $_POST["from"]; // sender
    $subject = $_POST["subject"];
    $message = $_POST["message"];
    $message = wordwrap($message, 70);
    mail("test@example.com",$subject,$message,"From: $from\n");
    echo "Thank you for sending us feedback";
}

当我在localhost中运行此程序时,输出显示为“谢谢您向我们发送反馈”,但在test@example.com中未收到任何邮件。

检查您的php.ini配置文件并添加邮件服务器配置:

SMTP = server ; mail server 
smtp_port = 25 ; port
sendmail_from = your@email.com ;

要么

使用PHPMailer https://github.com/PHPMailer/PHPMailer通过gmail,yahoo或任何外部邮件服务器发送邮件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM