Welcome to my new column, "Tricks of the Trade," for Zend.com! I'm excited to be sharing my thoughts about PHP every month. Between my book, the FreeTrade project, and the PHP mailing lists, I come across many interesting problems. I will be bringing the best of these issues to this column regularly.
A contact form or an email form is often a critical part of a website, in allowing users to contact you regarding one or more issues. It is common in this day and age, not to provide a direct email address on your website in order to try and prevent yourself from receiving spam emails in the future. However, what many webmasters would do is to use a form mail script, which usually still contains the email address hidden in the form. Nowadays, email harvesters (programs that search the internet for email addresses) can search both visible and non visible text for email addresses.
The simple PHP mail() function is safe, reliable, easy to use and very useful. Below we'll show you step-by-step different ways to use the mail() function. Including sending a basic e-mail with sender, receiver, subject and body, an e-mail with a few receivers and then a full blown example with headers, HTML e-mail and the works.
Tired of sending those drab textual notifications and newsletters to your friend and clients? Ever wanted to send attachments and/or HTML embedded email.
The answer is MIME. The ensuing few pages explain the basics of MIME, creating MIME-compliant messages and then ends with a working class implementation of sending MIME complaint email in PHP. Note that references to calling script, caller etc. denote the script that uses the class we are about to develop and client/MUA etc. denote a mail reading client or mail user agent.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.