1<?php 2/* 3 * Copyright Intermesh 4 * 5 * This file is part of Group-Office. You should have received a copy of the 6 * Group-Office license along with Group-Office. See the file /LICENSE.TXT 7 * 8 * If you have questions write an e-mail to info@intermesh.nl 9 * 10 */ 11 12/** 13 * This class is used to parse and write RFC822 compliant recipient lists 14 * 15 * @package GO.module.email 16 * @version $Id: RFC822.class.inc 7536 2011-05-31 08:37:36Z mschering $ 17 * @author Merijn Schering <mschering@intermesh.nl> 18 * @copyright Copyright Intermesh BV. 19 */ 20 21 22namespace GO\Email; 23 24 25class Transport extends \Swift_SmtpTransport{ 26 27 public static function newGoInstance(Model\Account $account){ 28 $encryption = empty($account->smtp_encryption) ? null : $account->smtp_encryption; 29 $o = new self($account->smtp_host, $account->smtp_port, $encryption); 30 31 if(!empty($account->smtp_username)){ 32 $o->setUsername($account->smtp_username) 33 ->setPassword($account->decryptSmtpPassword()); 34 } 35 36 // Allow SSL/TLS and STARTTLS connection with self signed certificates. Enabling this will not check the identity of the server 37 if($account->smtp_allow_self_signed){ 38 $o->setStreamOptions(array('ssl' => array('allow_self_signed' => true, 'verify_peer' => false, 'verify_peer_name' => false))); 39 } 40 41 return $o; 42 } 43} 44