Do you want to send today's entry to your blog? Do you have a
newsletter that cannot detect false receiver email addresses? Even
though mailing lists are often supported by software such as mailman, ezmlm or
majordomo it can be of great value to be able to receive mails via php.
Newsletter, trouble-ticket-systems, an archive of mails, or an email
based administration of websites or onlineshops are being enabled, if received
mails are automatically detected upon arrival.
You can achieve this by regularly connecting your POP or IMAP Server.
Problems occur when these servers are only allowing so many connections
per hour, file attachments are having to be processed or wrong passwords and
other causes of error have to be taken care of. One of the main problems
is you are not being notified once an email arrives. You have to connect to
your account and download the mail. The download of big mails will slow
down your script and due to this circumstance you might receive emails that
are a minute or an hour old. On the other hand, you might connect to your
account a thousand times without downloading/receiving any mail at all.
My solution (Bjoern SChotte deals with this subject on
contentmanager.de) is based on a PHP scriptfile that is being called up once mail is being
received. Requirement: A user account on the mailserver. The
.forward-file in the directory of this user might be interpreted by postfix or
sendmail, and will then start the script.
If you are working with an application that does not have to be
informed in case of an arriving email, then POP3 and the IMAP functions are great to
work with, as well as the PEAR-POP-functions or other implementations.