Email forms on a website are one of the most important ways in which customers can contact you. Email is also used to confirm a new user who wants to sign up for your website.
"sendmail" is a program which delivers mail over the Internet. Most web hosting providers include sendmail which your PHP website can use. You cannot send email from your local development environment unless you install sendmail or its equivalent on your local machine.
The PHP "mail()" command is part of the PHP core, and is the primary way in which to send email from PHP. mail($to, $subject, $message, $additionalHeaders) For multiple recipients, separate the email addresses of the recipients with commas
Common additional headers include "From", "CC", and "BCC" It is important to understand and use additional headers in order to provide better responsiveness to website customers.
PHPMailer, swiftmailer and PEAR libraries The various PHP frameworks including Zend Framework, Code Igniter and cakephp all have email libraries included
The disadvantage is that you need to download the library and make sure it is in your php.ini "include_path". You can use "set_include_path()" to set the path as your PHP program runs
1. require_once("/path/to/phpmailer/class.phpmailer.php") 2. $mail = new PHPMailer(); 3. Use the desired $mail->xxx() commands such as $mail->SetFrom()
It is recommended that you use an external library, such as PHPMailer On the PHPMailer object $mail, issue the $mail->IsSMTP() command and then configure the needed parameters as required by your SMTP server