The world, how it works, surroundings, myself, etc.

Tuesday, February 21, 2006

Sending mails with php

PHP has this mail() function to send mails. However, it's more than
plain vanilla to use it to send mails, esp if you don't have a fully
qualified domain name (FQDN), i.e. all systems on the LAN. Of course you
could use network/socket functions to connnect to the smtp port of your
mail server, but below I describe something simpler.

1. Edit /etc/mail/ to add your relay server:
You should have a line beginning with "DS"
Append to it your mail server.

2. Start sendmail

3. Use the mail() function, as is.

Note: Of course, this works only if the mail server allows you as a
relay host. i.e. your system must be trusted. All systems on the LAN,
generally, are.

Post a Comment