Mails not working, `/etc/msmtprc: Permission denied`
See original GitHub issueTroubleshooting
- I have attempted to troubleshoot this already
Describe the bug
Sending emails does not work. Fails with an error PHP Mailer - Could not instantiate mail function.
.
10updocker logs
shows:
phpfpm_1 | ln: failed to create symbolic link '/etc/php.d/15-xdebug.ini': No such file or directory
phpfpm_1 | Added $DOCKER_INTERNAL_HOST to hosts /etc/hosts
phpfpm_1 | /entrypoint.sh: line 3: /etc/msmtprc: Permission denied
phpfpm_1 | /entrypoint.sh: line 10: /etc/php-fpm.d/www.conf: Permission denied
phpfpm_1 | /entrypoint.sh: line 28: /etc/php/7.4/mods-available/newrelic.ini: Permission denied
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: fpm is running, pid 1
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: ready to handle connections
phpfpm_1 | [03-Oct-2022 18:54:07] NOTICE: systemd monitor disabled
phpfpm_1 | [03-Oct-2022 18:54:09] WARNING: [pool www] child 23 said into stderr: "NOTICE: PHP message: Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port) :-("
⋮
phpfpm_1 | [03-Oct-2022 18:54:18] WARNING: [pool www] child 23 said into stderr: "sendmail: account default not found in /etc/msmtprc"
MailCatcher is completely empty
Steps to Reproduce
10updocker upgrade
and10updocker create
with all the defaults- Send any email from the WordPress instance
- check the logs
- check the MailCatcher http://localhost:1080/
Screenshots, screen recording, code snippet
- Device: Asus UX501
- OS: Ubuntu 22.04
- Docker version 20.10.12, build 20.10.12-0ubuntu4
- docker-compose version 1.28.4, build cabd5cfb
- msmtop version:
$ 10updocker shell tomalec@c5110398ac34:/var/www/html$ sendmail --version msmtp version 1.8.16
Environment information
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
SendMail Error: Permission Denied :( - LinuxQuestions.org
I am trying to send Gmail emails from Terminal. ... The error means that the user running msmtp does not have write permissions...
Read more >Awk permission denied when run through msmtp
I am using gpg2 and awk jointly with msmtp to send emails in emacs. This is the ...
Read more >msmtp: cannot read custom aliases file (Permission denied)
Source: msmtp Version: 1.8.3 Severity: normal Dear Maintainer, when specifying a custom aliases file in /etc/msmtprc configuration file like ...
Read more >Smartd unable to send mail - Server Fault
send-mail: cannot connect to smtp.gmail.com, port 587: Permission denied send-mail: could not send mail (account default from /etc/msmtprc).
Read more >msmtp cannot write to /var/log/msmtp/msmtp.log - Ask Ubuntu
I had the same error message, and ultimately changing permissions, creating the log file, etc., didn't work. The problem in my case was ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tomalec OK, I figured this out.
The docker image used for the
phpfpm
container is the 10up/wp-php-fpm. This image has anentrypoint.sh
file, which I’m assuming is executed every time the instance boots.If you check this file closely, you will notice that very early on this file, on line 3, the script attempts to write to the
/etc/msmtprc
file, which generates that error mentioned in your (and my) logs.phpfpm_1 | /entrypoint.sh: line 3: /etc/msmtprc: Permission denied
So, apparently, the script cannot write to the
/etc/msmtprc
file due to wrong permissions.Following your suggestion, I had to edit
.containers/php-fpm
and addRUN chmod a+x /etc/msmtprc
. So to give a full walkaround I did the following:cd
to theenv
folder.containers/php-fpm
and addRUN chmod a+x /etc/msmtprc
docker-compose build
If I run
cat /etc/msmtprc
in the WSL 2 terminal I get aNo such file or directory
error. Is that what you were running into before you addedRUN chmod a+x /etc/msmtprc
to thephp-fm
file?