Ejemplo n.º 1
0
/**
 * Send mail
 *
 * @param string $subject
 * @param string $body
 * @param string $fromEmail
 * @param string $toEmail
 * @param string $ccEmail
 * @param string $bccEmail
 * @param string $attachement
 * @param string $bodyEncoding
 * @param integer $priority
 */
function sendMail($subject, $body, $fromEmail, $toEmail, $ccEmail = null, $bccEmail = null, $attachement = null, $bodyEncoding = 'utf-8', $priority = 1)
{
    $oMail = new email();
    $oMail->From($fromEmail);
    $oMail->To($toEmail);
    if ($ccEmail) {
        $oMail->Cc($ccEmail);
    }
    if ($bccEmail) {
        $oMail->Bcc($bccEmail);
    }
    $oMail->Subject($subject);
    $oMail->Body($body, $bodyEncoding, "text/html");
    $oMail->Priority($priority);
    if ($attachement) {
        $oMail->Attach($attachement, "application/x-unknown-content-type", "attachment");
    }
    $oMail->Send();
}