sending mail using php and pear on windows

后端 未结 2 2104
-上瘾入骨i
-上瘾入骨i 2021-01-06 18:44

I am trying to send an e-mail using php script but i am getting errors this is my code.i am using xampp netbeans and windows. and i included pear in the php.ini file but sti

2条回答
  •  甜味超标
    2021-01-06 19:42

    I just ran into the same problem and solved it using:

    @require_once "Mail.php";
    ...
    $smtp = @Mail::factory('smtp', array('host' => $host,
                                            'port' => $port,
                                            'auth' => true,
                                            'username' => $username,
                                            'password' => $password));
    $mail = @$smtp->send($to, $headers, $body);
    if (@PEAR::isError($mail)) {
    

    Notice that I prepended an @ to all pear / mail calls.

    I prefer this solution to changing the general error message settings as I don't want to see the pear / mail warnings but I do want to see the ones that apply to my own code.

提交回复
热议问题