Thread View: pl.comp.lang.php
2 messages
2 total messages
Started by Jakub
Mon, 30 May 2022 13:05
How catch mail error
Author: Jakub
Date: Mon, 30 May 2022 13:05
Date: Mon, 30 May 2022 13:05
33 lines
2028 bytes
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
Re: How catch mail error
Author: Arnold Ziffel
Date: Fri, 02 Jun 2023 19:41
Date: Fri, 02 Jun 2023 19:41
36 lines
2309 bytes
2309 bytes
Jakub <jak74@interia.pl> wrote:
> I have this code to sand email:
This is polska grupa, so you can pisać po polsku.
> function sendEmail($to, $title, &$text) {
> $from = 'jakub@jakubowo.net';
Podanie swojego maila w takiej formie na Usenecie to może nie być
najlepszy pomysł :) Choć może już nawet harvestery tu wyzdychały.
> 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()
Uruchamiasz ten skrypt na Windows? Bo, z tego co widzę w dokumentacji,
serwer SMTP jest używany tylko na Windows.
Musisz ustawić serwer SMTP w php.ini (globalnie) lub przez ini_set
(lokalnie dla skryptu), tak jak jest napisane. Teraz jest ustawiony na
localhost, a wygląda na to, że na localhoście nie słucha żaden serwer
smtp (przynajmniej nie na standardowym porcie 25).
MX dla jakubowo.net to mail.jakubowo.net. Wychodzący serwer może być inny,
ale pewnie jest ten sam, więc spróbuj ustawić:
ini_set('SMTP', 'mail.jakubowo.net');
--
Przychodzi mrówka do krawca i mówi:
- Jest nitka?
- Jest!
- Cale dwa cm proszę!
- Zapakować???
- Nie! Powieszę się na miejscu!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads