DeX Posted April 20, 2018 Share Posted April 20, 2018 I just set up my first mail server ever using Postfix and when I run echo testing | mail -s subjecttttt da***@*********.com it sends fine and I receive the email at that address. The problem is when I create a php page on the server and write mail("da***@*****.com", "test", "test"); then run the page in my browser, it doesn't send the email. From what I read online, it's because the root user on the command line has permissions to send mail while the www-data user in the browser does not. Is there a way I can specify which user Postfix uses? Any other suggestions? Thanks a lot. Link to comment Share on other sites More sharing options...
DeX Posted April 23, 2018 Author Share Posted April 23, 2018 Anyone? Link to comment Share on other sites More sharing options...
requinix Posted April 23, 2018 Share Posted April 23, 2018 First, use sudo to test whether the www-data user really can't send emails. Link to comment Share on other sites More sharing options...
DeX Posted April 23, 2018 Author Share Posted April 23, 2018 First, use sudo to test whether the www-data user really can't send emails. How can I do that if the command is being run through PHP and Apache? Link to comment Share on other sites More sharing options...
requinix Posted April 23, 2018 Share Posted April 23, 2018 No, sudo from the command line. Link to comment Share on other sites More sharing options...
DeX Posted April 23, 2018 Author Share Posted April 23, 2018 Is this correct? Daemon is the web user for Bitnami Apache. bitnami@ip-172-26-***-***:~$ sudo -u daemon echo "subjectt" | mail -s "bodyy" d*****@*****.com Link to comment Share on other sites More sharing options...
requinix Posted April 23, 2018 Share Posted April 23, 2018 No, that will run echo as daemon but mail as bitnami. It would be $ echo "subjectt" | sudo -u daemon mail -s "bodyy" d*****@*****.com Link to comment Share on other sites More sharing options...
DeX Posted April 24, 2018 Author Share Posted April 24, 2018 No, that will run echo as daemon but mail as bitnami. It would be $ echo "subjectt" | sudo -u daemon mail -s "bodyy" d*****@*****.com bitnami@ip-172-26-***.***:~$ echo "subjectt" | sudo -u daemon mail -s "bodyy" d*****@******.com /home/bitnami/Maildir/sent: Permission denied Failed to save message in "/home/bitnami/Maildir/sent" - message not sent Link to comment Share on other sites More sharing options...
DeX Posted April 24, 2018 Author Share Posted April 24, 2018 Never mind. I was trying to run the script on the wrong server, it appears it was working the whole time on the proper server. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.