簡體   English   中英

無法郵寄。 php mail()顯示警告

[英]Can not Mail. php mail() showing warning

警告:mail(/home/u295560656/.logs/php_mail.log):無法打開流:第9行的/home/u295560656/public_html/2.php中沒有此類文件或目錄

這是什么錯誤呢? 以前,我能夠發送郵件,但現在不能在Hostinger托管服務上發送郵件。

這是我的代碼:

<?php 
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL );
    $from = "smthing@gmail.com";
    $to = "smthing_else@gmail.com";
    $subject = "PHP Mail Test script";
    $message = "This is a test to check the PHP Mail functionality";
    $headers = "From:" . $from;
    mail($to,$subject,$message, $headers);
    echo "Test email sent";
?>

實際上,您已更改為Hostinger托管服務。 但是以前您使用了不同的托管服務。 我認為您已將日志文件的路徑定義為靜態值。 因此,請將日志文件的路徑更改為當前的托管服務。

否則通過使用以下語句來關閉警告

error_reporting(0); 用上面的語句替換第3行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM