What is wrong with this PHP script to send mail using Pear Mail?

后端 未结 3 559
花落未央
花落未央 2021-01-05 17:12

I have this script:

require_once \"Mail.php\";

 $from = \"Stephen \";//Google apps domain
 $to = \"username@gmail.com\";
 $sub         


        
3条回答
  •  天涯浪人
    2021-01-05 17:57

    Non-static method Mail::factory() should not be called statically

    This is a non-fatal notice coming from PHP because PEAR Mail is prehistoric and hasn't been updated to use the static keyword introduced five years ago in PHP5.

    After reviewing the documentation, your call to Mail::factory looks completely correct and normal.

    You failed to tell us if if the call to send succeeds or fails. If it's succeeding, but the mail is never being delivered, please check the SMTP server logs. If it's failing, what's the actual error message? The Mail::send documentation includes a comprehensive list of errors.

    You might want to consider using a more modern mail sending library, like Swiftmailer.

提交回复
热议问题