🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #232597

How catch mail error

#232597
From: Jakub
Date: Mon, 30 May 2022 13:05
33 lines
2028 bytes
	I have this code to sand email:


function sendEmail($to,  $title,  &$text) {
     $from = 'jakub@jakubowo.net';
     $subject = $title;

     $w = '<html><head><meta http-equiv="content-type" 
content="text/xhtml; charset=utf-8"></head>
            <body 
style="background-color:#ffffff;color:#000000;margin-top:30px;margin-left:30px;padding:10px;"><hr><br>'
           . $text . '<hr><br><p><a href="mailto:'
             . $from . '">' . $from . '</a></p></body></html>';

     $he = 'MIME-Version: 1.0' . PHP_EOL . 'Content-type: text/html; 
charset=utf-8 ' . PHP_EOL
               . 'From: admin Search. <' . $from . '>' . PHP_EOL
               . 'Content-Transfer-Encoding: base64' . PHP_EOL;

     $w = chunk_split(base64_encode($w));
     imap_mail($to, $subject, $w, $he);
   }


how to catch this error

Warning: imap_mail(): Failed to connect to mailserver at "localhost" 
port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use 
ini_set()

thank for answers

Jakub
Technical Details
Message-ID: <6294c0ff$0$463$65785112@news.neostrada.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.samoylyk.net!weretis.net!feeder8.news.weretis.net!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!news.samoylyk.net!weretis.net!feeder8.news.weretis.net!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!newsfeed.neostrada.pl!unt-exc-01.news.neostrada.pl!unt-spo-a-02.news.neostrada.pl!news.neostrada.pl.POSTED!not-for-mail
Date: Mon, 30 May 2022 14:05:03 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1
Newsgroups: pl.comp.lang.php
From: Jakub <jak74@interia.pl>
Subject: How catch mail error
Lines: 35
Message-ID: <6294c0ff$0$463$65785112@news.neostrada.pl>
Organization: Telekomunikacja Polska
NNTP-Posting-Host: 37.47.224.88
X-Trace: 1653915903 unt-rea-a-02.news.neostrada.pl 463 37.47.224.88:27907
X-Complaints-To: abuse@news.neostrada.pl
X-Received-Bytes: 1872
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit