$port); if (variable_get('zend_mail_smtp_encryption', 'none') != 'none') { $config['ssl'] = variable_get('zend_mail_smtp_encryption', 'none'); } $transport = new Zend_Mail_Transport_Smtp($host, $config); } } else { // this makes sure that zend_mail will just use the default, and we don't see any E_ALL stuff $transport = NULL; } $mail = new Zend_Mail(); foreach ($headers as $header => $value) { if ($header != 'Return-Path' && $header != 'From') { $mail->addHeader($header, $value); } } $mail->setBodyText($body); $mail->setFrom($from); $mail->addTo($to); $mail->setSubject($subject); try { $mail->send($transport); } catch (Zend_Mail_Transport_Exception $ex) { watchdog('zend_mail' ,'drupal_mail_wrapper - error (#'.$ex->getCode().') - '.$ex->getMessage(), WATCHDOG_ERROR); return FALSE; } return TRUE; }