Answer the question
In order to leave comments, you need to log in
How to set up sending mail from hosting?
I just tried digitalocean.com to set up sending mail from PHP, and, of course, I ran into the fact that earlier on hostings for mere mortals it was enough to call mail (), and in extreme cases, press a couple of buttons in the ISP panel, and now I have to tinker myself .
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.yandex.ru',
'username' => '[email protected]',
'password' => 'pass',
'port' => '25',
'encryption' => 'tls',
],
],
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Answer the question
In order to leave comments, you need to log in
If you have the same problem, then try:
1. Install sendmail. For me it was apt-get install sendemail
2. Set the path to sendemail in php.ini. I have this line sendmail_path = /usr/sbin/sendmail -t -i
3. I managed to connect to Yandex with encryption tls and port 25
4. The openssl extension should be installed. If phpinfo() shows that openssl is enabled and you have rebooted the server, this does not mean that the extension is enabled and working. It was a discovery for me :( You also need to add extension=openssl.so to php.ini
The answer is off topic. But to control and maintain your mail server, without the need for extra work. Yes, and your letters will be in spam, without certificates. There are a lot of mail delivery services that free us (developers) from unnecessary work. Personally, I use sendgrid.net for free 200 emails per day, there is a rest api and smtp
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.yandex.ru',
'username' => '***',
'password' => '***',
'port' => '587',
'encryption' => 'tls',
'streamOptions' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
]
]
],
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question