Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param string $subject
- * @param string $content
- * @param string $from
- * @param string $to
- * @param string $end
- */
- private function sendNotification( $subject, $content, $from, $to, $end )
- {
- $config = Context::getInstance()->get( 'app' )->getConfig();
- // Create the Transport
- $Transport = \Swift_SmtpTransport::newInstance( 'smtp.gmail.com', 465, 'ssl' )
- ->setUsername( $config['mail']['username'] )
- ->setPassword( $config['mail']['password'] );
- $Mailer = \Swift_Mailer::newInstance( $Transport );
- $this->setTemplateName( 'index/mail/' . $end . '_mail' );
- $template = $this->view->getTwigInstance()->loadTemplate( $this->view->getTemplateName() . '.twig' )->render( array(
- 'subject' => $subject,
- 'content' => $content,
- ) );
- // Create a message
- $Message = \Swift_Message::newInstance( $subject )
- ->setFrom( $from )
- ->setTo( $to )
- ->setBody( $template, 'text/html' );
- // Send the message
- $result = $Mailer->send( $Message );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement