diff options
Diffstat (limited to 'app/Integration/Smtp.php')
-rw-r--r-- | app/Integration/Smtp.php | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/app/Integration/Smtp.php b/app/Integration/Smtp.php deleted file mode 100644 index 3ef6539d..00000000 --- a/app/Integration/Smtp.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php - -namespace Kanboard\Integration; - -use Swift_Message; -use Swift_Mailer; -use Swift_MailTransport; -use Swift_SendmailTransport; -use Swift_SmtpTransport; -use Swift_TransportException; - -/** - * Smtp - * - * @package integration - * @author Frederic Guillot - */ -class Smtp extends \Kanboard\Core\Base -{ - /** - * Send a HTML email - * - * @access public - * @param string $email - * @param string $name - * @param string $subject - * @param string $html - * @param string $author - */ - public function sendEmail($email, $name, $subject, $html, $author) - { - try { - - $message = Swift_Message::newInstance() - ->setSubject($subject) - ->setFrom(array(MAIL_FROM => $author)) - ->setBody($html, 'text/html') - ->setTo(array($email => $name)); - - Swift_Mailer::newInstance($this->getTransport())->send($message); - } - catch (Swift_TransportException $e) { - $this->container['logger']->error($e->getMessage()); - } - } - - /** - * Get SwiftMailer transport - * - * @access private - * @return \Swift_Transport - */ - private function getTransport() - { - switch (MAIL_TRANSPORT) { - case 'smtp': - $transport = Swift_SmtpTransport::newInstance(MAIL_SMTP_HOSTNAME, MAIL_SMTP_PORT); - $transport->setUsername(MAIL_SMTP_USERNAME); - $transport->setPassword(MAIL_SMTP_PASSWORD); - $transport->setEncryption(MAIL_SMTP_ENCRYPTION); - break; - case 'sendmail': - $transport = Swift_SendmailTransport::newInstance(MAIL_SENDMAIL_COMMAND); - break; - default: - $transport = Swift_MailTransport::newInstance(); - } - - return $transport; - } -} |