function getContent($smtp_server, $smtp_port, $transport, $smtp_username, $smtp_password, $body, $attachments)
 {
     //Load in the files we'll need
     Env::useLibrary('swift');
     switch ($transport) {
         case 'ssl':
             $transport = SWIFT_SSL;
             break;
         case 'tls':
             $transport = SWIFT_TLS;
             break;
         default:
             $transport = 0;
             break;
     }
     //Start Swift
     $mailer = new Swift(new Swift_Connection_SMTP($smtp_server, $smtp_port, $transport));
     if (!$mailer->isConnected()) {
         return false;
     }
     // if
     $mailer->setCharset('UTF-8');
     if ($smtp_username != null) {
         if (!$mailer->authenticate($smtp_username, self::ENCRYPT_DECRYPT($smtp_password))) {
             return false;
         }
     }
     if (!$mailer->isConnected()) {
         return false;
     }
     // add attachments
     $mailer->addPart($body);
     // real body
     if (is_array($attachments) && count($attachments) > 0) {
         foreach ($attachments as $att) {
             $mailer->addAttachment($att["data"], $att["name"], $att["type"]);
         }
     }
     $content = $mailer->getFullContent(false);
     $mailer->close();
     return $content;
 }