Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm a novice when it comes to server admin, and I need some help. I recently got sick of GoDaddy, and I signed up for an unmanaged rackspace server. I'm running a Debian instance, and I'd like to set up the server to send outgoing email via PHP and via cron.

PHP and Apache are already installed. I've installed sendmail, via apt. I have no idea how to set any of this up. I don't really need inbound support, although I imagine it would be nice for my PHP emails. (Or I can just have sendmail() change the return address in my PHP script.)

Specifically, I have no idea how to configure sendmail as an outgoing mail server. How would I do that?

share|improve this question

closed as not constructive by Sven, mdpc, chutz, voretaq7 Dec 21 '12 at 3:34

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 1 down vote accepted

Looks like the default sendmail config on Debian allows outbound relaying, and listens on 127.0.0.1 by default - pretty much the config you need.

Try testing with something like this:

root@test1:~# mail outside-address@example.com
Subject: test
asdf
.

..and check if the listener is working:

netcat localhost 25

If the message works outbound, then you should be in good shape.

For cron, the email is send to the user that owns the job; if you want those messages going outbound, set up an alias for the user the cron is running under in /etc/aliases.

For PHP, you should be able to configure the application to point to localhost, port 25, and have it successfully send mail outside.

share|improve this answer
    
Ok, so sending via the mail command works. How would I configure aliases? –  Moshe Dec 21 '12 at 2:20
    
Say you wanted mail bound for the root user to go to someone@gmail.com. Add a line to /etc/aliases like this: root: someone@gmail.com –  Shane Madden Dec 21 '12 at 2:24
    
Got it, thanks. –  Moshe Dec 21 '12 at 2:35

Start with a guide, such as http://www.wikihow.com/Configure-Sendmail. Or google other guides, find one you can follow, go through the steps and read the readme files.

Heres a better one http://frenchtouch.pro/tutorial/configure-your-debian-server-to-send-mails/47

share|improve this answer
    
We really do prefer that answers contain content not pointers to content. Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Iain Dec 21 '12 at 7:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.