Answer the question
In order to leave comments, you need to log in
How to set up Postfix for third party clients?
I welcome everyone.
I set up a mailer on the VPS server according to these instructions . I did everything as described, including setting up DNS and the postfix config itself. Letters leave the native web interface instantly and do not end up in spam.
But, as soon as I try to send an email through a PHP script (SwiftMailer from Yii2), then either emails are sent in ~20 seconds, or most often they are not sent at all - Yii2 swears "Expected response code 250 but got an empty response".
The task is to ensure that all letters are sent quickly from my php script, regardless of the IP address where the script itself is located.
Here is the postfix main.cf config:
https://disk.yandex.ru/d/GIRKgGWYuxayng
Here is an example of an error from the log:
And this is how I send emails:
\Yii::$app->mailer->htmlLayout = "@app/mail/layouts/html";
$message = \Yii::$app->mailer->compose (['html' => '@app/mail/views/create-user']);
$message->setFrom (['[email protected]' => 'Администратор '.Yii::$app->params['appName']]);
$message->setTo ("[email protected]");
$message->setSubject ('Учётная запись обновлена');
$message->send();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question