SMTP_PORT)); $mail->setDefaultTransport($tr); $mail->setFrom($from); if ( count($to) > 0 ) { foreach ( $to as $item ) { $mail->addTo($item); } } $mail->setSubject($subject); if ($text!='') { $mail->setBodyText(mb_convert_encoding($text, 'ISO-8859-15', 'UTF-8')); } if ($html!='') { $mail->setBodyHtml(mb_convert_encoding($html, 'ISO-8859-15', 'UTF-8')); } if ( count($tabAttachedFiles) > 0 ) { foreach ($tabAttachedFiles as $file) { $at = new Zend_Mime_Part( file_get_contents( $file ) ); $mail->addAttachment($at); } } try { $mail->send(); } catch (Zend_Mail_Transport_Exception $e) { file_put_contents(LOG_PATH.'/sendMailError.log',date('Y-m-d H:i:s')." - ".$e->getMessage().PHP_EOL, FILE_APPEND); } catch (Zend_Mail_Protocol_Exception $e) { file_put_contents(LOG_PATH.'/sendMailError.log',date('Y-m-d H:i:s')." - ".$e->getMessage().PHP_EOL, FILE_APPEND); } } ?>