Jump to content

mail() not working in browser but works fine from command line


DeX

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.