enable email notifications vi msmtprc
open questions are how we set msmtp as default email sender and where the logfile should be located #31
and maybe we should discuss the password handling http://manpages.ubuntu.com/manpages/bionic/man1/msmtp.1.html
Carrying over the conversation from #31 -- I think what you have makes sense, and should theoretically work, although I haven't had time to set up a test build myself.
I have three comments:
-
If you look at msmtp configs for various providers here, there are several attributes that this current solution does not provide access to via environmental variables --
port,tls_starttls,tls_certcheck, etc.
Mounting the msmtprc or msmtp_php file a a volume as I mentioned in my comment on #31 would allow more flexibility at the cost of potentially overwhelming less technical end users. It also keeps potentially private information out of the plaintext dockerfile, and doesn't require adding in a script to parse docker secrets passed as environmental variables with '_FILE' appended. This is a design decision, and I don't think there's a specific right or wrong way to go about it. If you'd like help with the secret parsing script, I think I can dig up one I've used before. -
Regarding setting msmpt as default mail sender, the mchodled article has some manipulation to the
sendmail=entry of/etc/php/8.0/fpm/php.ini. I do not see this in your solution. However, I'm not super familiar with apache, PHP, or msmtp, so it's entirely possible that your solution may work without it -- I just don't know. If needed, I wrote a potential replacement withsedin my comment #31 -
It appears that the current implementation requires providing one's own tls/ssl cert, specifically named
ca-certificates.crtand mounted in/etc/ssl/certsas detailed in themsmtprcfile. The docker-compose.apache example has the certs mounted inetc/ssl/private. I think the cert path needs to be consistent, and the documentation needs to be updated regarding the cert requirement.
My solution works, I am already using it. So 2. is solved. I still don't know which solution is superior, so if you have any information on that, I appreciate it.
Yeah, I tried to find a very simple solution for 1. to get it working and to see what other think about it. I am not sure if that's good or bad, but probably it's better to allow for a more sophisticated solution, maybe providing my solution as fallback.
About 3. I think the solution does not require any certificates since it's using a hosted mail server. It's about installed certificates on the server to probably verify the correct mail server. So I can't see a cert mount. But I might be wrong.
Closing, msmtp has been added in PR https://github.com/ckulka/baikal-docker/pull/63
Thank you @philippneugebauer though for the PR, your work and that of the others helped a LOT to make this work!