gpt4 book ai didi

PHP 邮件功能从服务器发送但不是从 php

转载 作者:太空宇宙 更新时间:2023-11-04 12:37:59 25 4
gpt4 key购买 nike

我最近在我的 php 中安装了邮件,当我在我的命令服务器上这样做时我可以发送邮件但是当我在 php 上使用它时,我没有收到电子邮件

<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);
require "connection.php";
$email = $_POST['email'];

if(isset($_POST['submit']))
{

$check = mysqli_query($conn, "select * from users where email = '$email' ");
$row = mysqli_fetch_array($check);

$message ="Please click here to create a new password www.jasmine.com/id?=" . $row['id'];
$subject = 'Change password';
$body = "E-Mail: $email\n Message:\n $message";

if($row)
{

$res = mail ($email, $subject, $body);
var_dump($res);die;
echo "Please check your email";
}
}
else
{
echo "Email Not Found";
}
?>

我在整个网站上进行了研究,但没有找到任何帮助我尝试过1)查看25端口是否被阻塞,没有。2) 我试过这段代码,看看是否有任何东西会发送:

<?php
mail('youremailaddress@here.com','Test Email','Testing to see if this comes through');?>

不,它没有3)当我做 telnet domain.com 25我刚刚得到

尝试IP...

telnet: 连接到地址 IP: 连接被拒绝)

[root]# netstat -plnt |grep :25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1228/master
tcp6 0 0 ::1:25 :::* LISTEN 1228/master

还有什么我可以做的让它真正工作吗,我按照这个网站上的步骤安装了邮件,它应该一切正常 http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/

最佳答案

如果你能手动发送邮件,邮件服务器是可以的。php 邮件似乎有问题 - 默认情况下,它使用 sendmail。

您可以尝试删除 postfix 并安装 sendmail(记得停止/终止 postfix 服务!)。

关于PHP 邮件功能从服务器发送但不是从 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41124569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com