Send an email using PHP on Ubuntu Server
Send an email using PHP on Ubuntu Server
I asked this question a year ago, but I’m not sure what I did. When I came back to the post, I couldn’t recall my actions. I followed the guide from DigitalOcean, but it didn’t work—probably because port 25 is blocked. I need a simple way to send emails using PHP only. I tried configuring Postfix as an SMTP server, but PHPMailer returned error 554 even though I provided the correct details (port, address, no SSL, no auth). What should I do?
applications using port 25 must be executed with root privileges, which could explain your issue. The guidance you received is quite detailed and tailored to a specific task, while you're simply aiming to send emails. You only need to run "sudo apt install php-mail". Unlike the example link, I haven't adjusted any default settings on an Ubuntu server for email sending. For reference, you can check out these sites: http://www.w3schools.com/php/func_mail_mail.asp and http://www.w3schools.com/php/php_ref_mail.asp
I managed to fix it again now. I have a guide saved, but I’m wondering how to make it send from my domain instead of my hostname. All the examples I’ve seen still use the hostname. EDIT: Adding the 'From' headers works, but I heard it might trigger spam filters since it’s not a full FQDN. This seems to match what’s happening because emails keep landing in spam even though I allow that domain.