Sending Mail from a LAMP Container

After much fiddling, I’ve managed to install Snipe-IT on a LAMP container. The application needs to send mail, and I set it up to use gmail to send mail (which worked fine). However, I’d like to switch things around so it is sending mail internally (as opposed to using an external service).

As outlined in the documentation (Configuration) it can be set to use the system’s php mail function or the server’s sendmail.

So, some questions:

(1) is there any reason to choose one option over the other? php mail function vs. the server’s sendmail

(2) are either option something I need to enable? if this is the case, how do I do that (I’m assuming enabling the php mail function can be done in php.ini

(3) how do I find the host name for the outgoing mail server?

(4) do I need to set up a separate user to send the mail?

Any thoughts would be appreciated.

This StackOverflow answer seems to indicate that the php mail() function ultimately just uses sendmail in the background for the actual sending. I always recommend using an external SMTP service when possible because it is a nightmare trying to get email from a server to not go to junk mail. SPF, DKIM keys, you can do so much and still have it end up in spam and meanwhile services like Mailgun will give you thousands of emails a month for free. To me it’s a no brainer. Gmail is good if you’re not sending a lot (I think their limit is like 100 outgoing per day).

As far as your questions PHP mail() is on by default and should work. Outgoing server hostname will be based on the node ID number. You can probably just put in the app but you can also type hostname in a shell environment to see what the hostname is. I don’t believe user/pass is going to be required by default unless you configure sendmail to use one. But again, don’t be surprised if after all that work things still end up in junk mail. I wouldn’t wish managing a mail server on my worst enemy :slight_smile:

1 Like

appreciate your thoughts. Man, email is a PITA. Its frustrating that we have to rely on an external service to deal with email…and the vast majority of these server side applications require email for core functionality. Sigh. Do you know of any more ethical, open, community oriented service that could replace gmail in this regard? I’ll experiment with using the server side email tooling, and see what happens.

I really like to recommend ProtonMail for that, they appear to be very ethical, secure, and open source as well.

Thanks. I’ll have a look.