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

I have a dedicated server which I want to use to run a LAMP stack on. Now, I want to use php mail on that server.

How do I go about doing that?

PS: it is an ubuntu server.

Thanks

share|improve this question

4 Answers 4

Personally I prefer Exim, the below steps will get a system up and going for outgoing mail only.

  • Make sure the hostname is setup correctly
  • Install apt-get install exim4 exim4-daemon-light
  • At the configuration step answer the questions this way
    • Type of mail configuration: Internet site
    • System name: the fqdn for your server
    • IP-Address to listen on: 127.0.0.1 (with this address incoming mail is not possible)
    • Other destinations which is accepted: empty
    • Domains to relay for: empty
    • machines to relay for: empty
    • Keep DNS minimal: yes
    • Delivery method for local mail: Maildir
    • Yes Split configs

Once exim is already configured you can run though this setup again by using the command dpkg-reconfigure exim4-config

You might want to consider choosing to use the Smarthost options during the above setup and direct your mail through an already established SMTP server that will relay for you. The other server will have probably already handled getting the DNS records setup correctly.

share|improve this answer
    
+1 thanks. A few questions, though: what is an MTA and an MDA? is Exim an MDA or MTA or both? And how will I configure PHP mail to use this server? Also, I only need to send out email from the server, receive email. So do I need an MDA? And what is sendmail? –  harshath.jr Mar 19 '10 at 10:30
    
MTA = Mail Transfer agent (en.wikipedia.org/wiki/Message_transfer_agent) -- MDA = Mail Delivery agent (en.wikipedia.org/wiki/Message_delivery_agent) -- The sendmail is one of the oldest *nix MTAs. It included a binary that almost all other *nix MTAs emulate that allows you to send email through a command. Exim performs both MTA and MDA functions, so with exim you get what you need. As for how to send via PHP, I like to use PHPMailer (stackoverflow.com/search?q=phpmailer) –  Zoredache Mar 19 '10 at 15:04
    
okay, so what does an MTA do? to send mail, do I need an MTA or an MDA? if I install sendmail, and decide to use PHP mail() function instead of PHPMailer, how do I tell php to use sendmail? –  harshath.jr Mar 20 '10 at 10:23

You need to setup your system as a mail server. Have a look at the following documentation: https://help.ubuntu.com/community/MailServer

share|improve this answer
    
I already came across this, but I'm new to setting up a mail server. I still don't have the basics, like what MTAs and MDAs do –  harshath.jr Mar 20 '10 at 10:22

I prefer to have PHP use our regular mail server as it has the correct reverse DNS entries, security patches etc.

If you use PHPMailer you can easily use your regular SMTP server - it does authentication too!

share|improve this answer
    
I need to install an SMTP server, i think. We have a dedicated server, not a shared host. –  harshath.jr Mar 19 '10 at 10:25
    
@harshath.jr Not sure what difference a dedicated or shared host makes. You must already have an email server - why not use it? –  Jon Rhoades Mar 19 '10 at 11:44
    
okay, what does "it does authentication too" mean? what kind of authentication are you talking about? who is authenticating to whom? –  harshath.jr Mar 20 '10 at 10:21
    
@harshath.jr Err... SMTP authentication - where you log into your SMTP server with your Username and Password to send email. –  Jon Rhoades Mar 20 '10 at 12:41
    
okay.... so if I install sendmail on my server, will I be able to send emails via PHP? (I know this question sounds very lame. I have absolutely no clue as to how to set up a mail server, and how to have php use it.) –  harshath.jr Mar 20 '10 at 13:59

For the Windows People: Hamster Classic is the way to go if your developing on Windows. You can get a test mail server running in just a few minutes and it allows to to inspect the mail packets in detail.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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