YunoHost-Apps / monica_ynh

Monica package for YunoHost
https://www.monicahq.com/
GNU Affero General Public License v3.0
18 stars 13 forks source link

Mails not working - solution included #71

Open TabTwo opened 1 year ago

TabTwo commented 1 year ago

Describe the bug

Mails, like reminders for birthdays did not work

Context

normal user of Monica

Steps to reproduce

do a clean install of the current version, add some contacts, no mails, nothing in /var/log/mail.log

the error

su - monica $ /usr/bin/php8.1 /var/www/monica/artisan monica:test-email

What email address should I send the test email to?:

ralph@mayer.rocks

Preparing and sending email to "ralph@mayer.rocks"

In SocketStream.php line 171:

Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=star.mayer.rocks' did not match expected CN=127.0.0.1'

so, Monica tries to talk to postfix but fails because the cert does not include 127.0.0.1 (as it should since that would be a bad idea)

the solution

edit /var/www/monica/.env and set

MAIL_HOST=star.mayer.rocks (the fqdn of the yunohost) MAIL_HOST=null (disable tls)

after that su - monica $ /usr/bin/php8.1 /var/www/monica/artisan config:cache

INFO Configuration cached successfully.

$ /usr/bin/php8.1 /var/www/monica/artisan monica:test-email

What email address should I send the test email to?:

ralph@mayer.rocks

Preparing and sending email to "ralph@mayer.rocks" Email sent!

KaeruCT commented 1 year ago

Thanks for this solution.

I also got this to work by setting MAIL_ENCRYPTION=ssl in the .env file

LambertCliff commented 10 months ago

Thanks a lot for the workaround ! :+1: I was going nuts with this issue. In my case, I just edited MAIL_HOST as you said with my Yunohost's FQDN : MAIL_HOST=FQDN And I had to edit the MAIL_FROM_ADDRESS value like that because it was telling me "Sender address rejected: not logged in": MAIL_FROM_ADDRESS=monicahq@FQDN (it was originally monica@FQDN)