Enabling PHP mail() function to work on a load balanced droplet
Hello all, newb alert!
I was wondering if someone could help me or point me in the right direction…
I have an PHP CodeIgniter application which I am migrating from a managed shared hosting provider and I wanted to test my skills by bringing it into DO. I brought it into DO so that I could implement a HA Proxy load balancer and 3 x Application Server Droplets (1 as backup).
All the app servers are configured identically (CentOS 7) and the load balancer (CentOS 7) is pointing to the app servers in a round robin configuration.
Everything is working as it should apart from e-mails.. The issue I am facing is that when the app now tries to use the PHP Mail() function, it fails because i’m guessing there is no mail server set up? The main MX records to the domain are pointing to Microsoft as Office365 is used for managing that aspect. However I would still like all three app servers to be able to send mail from the PHP application (new user registration confirmation/notifications etc..).
As the domain is not pointed to the app servers and instead to the load balancer, how do I configure the app servers to correctly send email from an address? (eg. email@example.com)
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×