I installed Ubuntu 11.04, LAMP using tasksel.
I find that PHP mail() does not work.
I suppose I need to enable it or something? How do I do that?
|
|
|
From the mail manual of php:
This means you have to install some sort of mailserver and configure php to use it. Usually this mailserver is postfix in Ubuntu. However - if the php side you are coding will eventually be stored on a hosting service's side (e.g. xmission), a mail server will most likely allready be installed there. In that case just test your site online instead of locally. If you need to test it on your own system or mean to host it on your own home-server than proceed with: Postfix InstallationInstallation: postfix
The rest of the install options depend on your choice of this general configuration. Most likely you will choose a satellite install. That means mail will be send using an extern provider. As smtp-server (outgoing mail server) you will then have to specify your providers smpt. The rest of the options is self explanatory. Post Installation ConfigurationMost smtp-servers require a password authentication to send mail. So postfix will need to know that password. Also there are things like encryption to consider (which you'll have to google). This is how you configure postfix using password authentication (sasl):
This should do it in most of the cases. Yet some smpt providers require a specific address as the sender or encryption. Related: PEAR::Mail interface might also be of intrest to you. |
|||||||||
|
|
PHP requires an SMTP client to send mail. You could install a full-featured mail transfer agent (MTA) like Postfix to serve this function, but it's overkill if you only need to send mail through PHP. Instead, install msmtp. It's lightweight and much simpler to configure. Install msmtp
Configure it Create a new configuration file:
...with the following configuration information:
You need to put your own configuration information within each "<" and ">". For host/username/password, use your normal credentials for sending mail through your mail provider. Tell PHP to use it
Add this single line:
Set up logging
Add these lines to the new file:
If you'd like to be able to view the logs as yourself, you should add yourself to the www-data group. |
|||||||
|
|
Should be a simple fix. You just need to install Postfix which does the actual emailing.
You want to run that from a terminal (and not the software centre) because it needs to ask you a few setup questions. You should be find to just accept all the defaults (local-only, etc). |
|||
|
|