Пример #1
0
 public static function setUpBeforeClass()
 {
     if (false === \getenv('EMAIL_USER')) {
         throw new \PHPUnit_Framework_SkippedTestError('Please set environment variable EMAIL_USER before running functional tests');
     }
     if (false === \getenv('EMAIL_PASSWORD')) {
         throw new \PHPUnit_Framework_SkippedTestError('Please set environment variable EMAIL_PASSWORD before running functional tests');
     }
     $user = \getenv('EMAIL_USER');
     $password = \getenv('EMAIL_PASSWORD');
     $password = \OC::$server->getCrypto()->encrypt($password);
     $a = new MailAccount();
     $a->setId(-1);
     $a->setName('ownCloudMail');
     $a->setInboundHost('imap.gmail.com');
     $a->setInboundPort(993);
     $a->setInboundUser($user);
     $a->setInboundPassword($password);
     $a->setInboundSslMode('ssl');
     $a->setEmail($user);
     $a->setOutboundHost('smtp.gmail.com');
     $a->setOutboundPort(465);
     $a->setOutboundUser($user);
     $a->setOutboundPassword($password);
     $a->setOutboundSslMode('ssl');
     self::$account = new Account($a);
     self::$account->getImapConnection();
 }
Пример #2
0
 /**
  * Initialize Mapper
  */
 public function setup()
 {
     $db = \OC::$server->getDatabaseConnection();
     $this->db = new Db($db);
     $this->mapper = new MailAccountMapper($this->db);
     $this->account = new MailAccount();
     $this->account->setName('Peter Parker');
     $this->account->setInboundHost('mail.marvel.com');
     $this->account->setInboundPort(159);
     $this->account->setInboundUser('spiderman');
     $this->account->setInboundPassword('xxxxxxxx');
     $this->account->setInboundSslMode('tls');
     $this->account->setEmail('*****@*****.**');
     $this->account->setOutboundHost('smtp.marvel.com');
     $this->account->setOutboundPort(458);
     $this->account->setOutboundUser('spiderman');
     $this->account->setOutboundPassword('xxxx');
     $this->account->setOutboundSslMode('ssl');
     $this->account->setUserId('user12345');
 }
Пример #3
0
 /**
  * @param $email
  * @param $password
  * @param $name
  * @param $host
  * @param $port
  * @param string|null $encryptionProtocol
  * @param $user
  * @return MailAccount
  */
 public function connect($email, $password, $name, $host, $port, $encryptionProtocol, $user)
 {
     $account = new MailAccount();
     $account->setUserId($this->userId);
     $account->setName($name);
     $account->setEmail($email);
     $account->setInboundHost($host);
     $account->setInboundPort($port);
     $account->setInboundSslMode($encryptionProtocol);
     $account->setInboundUser($user);
     $password = $this->crypto->encrypt($password);
     $account->setInboundPassword($password);
     $a = new Account($account);
     $a->getImapConnection();
     $this->logger->info("Test-Account-Successful: {$this->userId}, {$host}, {$port}, {$user}, {$encryptionProtocol}");
     return $account;
 }