Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a Ubuntu/Apache/PHP machine to send email

I am working for a small Ho Chi Minh City company whose only server was just one old small computer. Now just a few months later, we are expanding rapidly and one of the requirements for new users is to require them to verify their email addresses.

There are no special programs on the Ubuntu box, instead the only thing I did on the actual server was re-format the entire hard drive from windows XP and installed Natty Narwhal on it, then install Apache and PHPMYADMIN.

I would like to have PHP to send out an email to both the user and the administrators as soon as somebody applies for membership. But I have no idea what I need to do to start.

Any ideas on what I need to set up first would be humbly appreciated; I am not looking for a step by step, just some tips to point me in the right direction.

-Duong Van

like image 337
Dương Văn Avatar asked Oct 17 '11 22:10

Dương Văn


2 Answers

sudo apt-get install sendmail will install a copy of sendmail that listens locally. If you install that, then php can use the built in mail() function. There also won't be a risk of becoming a remote relay if you install like this as well.

If you plan on sending mail out to other internet domains, you will need to make sure the IP address of the machine sending mail has a reverse DNS entry (PTR record) set up as well. Most large ISP's will reject your mail if your IP does not have a PTR record or one that points to a generic host (e.g. 1.2.3.3.domain.isp.com). It should reverse to something like mail.yourdomain.com

like image 192
drew010 Avatar answered Sep 20 '22 04:09

drew010


The native mail function is a good built-in option.

The mail function is part of the PHP core, but it does require sendmail to be installed on the server.

I believe sendmail might already be installed with the packages you have already selected, but you can check for it using the command:

dpkg --get-selections | grep sendmail 

If that comes up empty, you can install sendmail with:

sudo apt-get install sendmail 
like image 32
ghbarratt Avatar answered Sep 22 '22 04:09

ghbarratt