电子邮件无法在Plesk服务器上运行

时间:2018-06-07 11:13:19

标签: php email plesk plesk-onyx

我正在使用Plesk GoDaddy服务器向用户发送电子邮件。我试过这是简单的邮件PHP函数来发送邮件,但它给了我这个错误。

enter image description here

这是我尝试的代码。

<?php

    ini_set('error_reporting', E_ALL);
    error_reporting(E_ALL);

    if (isset($_POST)) {
        $name = $_POST['email'];
        $from = "info@site.ir";
        $to = 'si87841@gmail.com';  
        $subject = 'Test Sending';
        $message = 'You got a message from '. $name;
        $headers = array(
            'MIME-Version: 1.0',
            'Content-Type: text/html; charset="UTF-8";',
            'Content-Transfer-Encoding: 7bit',
            'Date: ' . date('r', $_SERVER['REQUEST_TIME']),
            'From: ' . $from,
            'Reply-To: ' . $from,
            'Return-Path: ' . $from
        );
        $mailsent = mail($to, $subject, $message, implode("\n", $headers));

       echo "this is mail sent---> " . $mailsent;
    }
?>

1 个答案:

答案 0 :(得分:1)

脚本本身正在运行。你的环境有问题。 验证简单的PHP脚本是否正常工作,如

<?php
echo "Test Script";
?>

据我了解,您在Windows上运行Plesk。在IIS中启用详细报告&gt;网站&gt; domain_name&gt;错误页面&gt;编辑功能设置

enter image description here

并检查详细错误。

如果信息不足,请检查EventViewer是否有错误,尝试启用failed request tracing via Plesk并检查报告。