Jakub
2022-05-30 13:06:28 UTC
I have this code to sand email:
function sendEmail($to, $title, &$text) {
$from = '***@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
function sendEmail($to, $title, &$text) {
$from = '***@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