question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mails not working, `/etc/msmtprc: Permission denied`

See original GitHub issue

Issue Description

Troubleshooting

  • 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

  1. 10updocker upgrade and 10updocker create with all the defaults
  2. Send any email from the WordPress instance
  3. check the logs
  4. 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:open
  • Created 4 months ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kmgalanakiscommented, Dec 29, 2022

@tomalec OK, I figured this out.

The docker image used for the phpfpm container is the 10up/wp-php-fpm. This image has an entrypoint.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 add RUN chmod a+x /etc/msmtprc. So to give a full walkaround I did the following:

  1. cd to the env folder
  2. Edit .containers/php-fpm and add RUN chmod a+x /etc/msmtprc
  3. Run docker-compose build
0reactions
jg314commented, Dec 29, 2022

If I run cat /etc/msmtprc in the WSL 2 terminal I get a No such file or directory error. Is that what you were running into before you added RUN chmod a+x /etc/msmtprc to the php-fm file?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found