PHP Mail using Zend Mail
This simple function is a simple usage of the Zend Mail functionality. The headers are all formatted nicely, slipping it past many more spam filters than standard PHP mail() function. Basically you just have to pass in an associative array of the required parameters. Many parameters are optional. This function does not have error trapping or input grooming/validation so depending on where you use it in your code, beware.
-
//FUNCTION TO SEND EMAIL VIA ZEND MAIL
-
function sendEmail($params){
-
require_once ('inc/Zend/Mail.php');
-
$mail = new Zend_Mail();
-
$mail->setFrom($params['fromEmail'], $params['fromName']);
-
$mail->addTo($params['toEmail'], $params['toName']);
-
$mail->setSubject($params['subject']);
-
$at->type = $params['attachType'];
-
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
-
$at->filename = $params['attachName'];
-
}
-
$mail->send();
-
}
Download Zend Framework. One thing to keep in mind is that you can use the classes in the Zend Framework outside the framework itself.
You’re currently reading “ PHP Mail using Zend Mail ,” an entry on BRADINO
- Published:
- 5.30.07 / 12am
- Category:
- PHP












