/**
  * @param \Magento\Framework\Mail\MessageInterface $message
  * @param \MagePal\GmailSmtpApp\Helper\Data $dataHelper
  * @throws \Zend_Mail_Exception
  */
 public function __construct(\Magento\Framework\Mail\MessageInterface $message, \MagePal\GmailSmtpApp\Helper\Data $dataHelper)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     //Set reply-to path
     $setReturnPath = $dataHelper->getConfigSetReturnPath();
     switch ($setReturnPath) {
         case 1:
             $returnPathEmail = $message->getFrom();
             break;
         case 2:
             $returnPathEmail = $dataHelper->getConfigReturnPathEmail();
             break;
         default:
             $returnPathEmail = null;
             break;
     }
     if ($returnPathEmail !== null && $dataHelper->getConfigSetReturnPath()) {
         $message->setReturnPath($returnPathEmail);
     }
     if ($message->getReplyTo() === NULL && $dataHelper->getConfigSetReplyTo()) {
         $message->setReplyTo($returnPathEmail);
     }
     //set config
     $smtpConf = ['auth' => strtolower($dataHelper->getConfigAuth()), 'ssl' => $dataHelper->getConfigSsl(), 'username' => $dataHelper->getConfigUsername(), 'password' => $dataHelper->getConfigPassword(), 'port' => $dataHelper->getConfigSmtpPort()];
     $smtpHost = $dataHelper->getConfigSmtpHost();
     parent::__construct($smtpHost, $smtpConf);
     $this->_message = $message;
 }
 /**
  * Constructor.
  *
  * @param  string $host OPTIONAL (Default: 127.0.0.1)
  * @param  array|null $config OPTIONAL (Default: null)
  * @return void
  */
 public function __construct($host = '127.0.0.1', array $config = array())
 {
     // remove empty helo dns name to force default (localhost)
     if (empty($config['name'])) {
         unset($config['name']);
     }
     parent::__construct($host, $config);
 }
 /**
  * Transport constructor.
  * @param \Magento\Framework\Mail\MessageInterface $message
  * @param \Dotdigitalgroup\Email\Helper\Transactional $helper
  */
 public function __construct(\Magento\Framework\Mail\MessageInterface $message, \Dotdigitalgroup\Email\Helper\Transactional $helper)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     $this->_message = $message;
     $this->_helper = $helper;
     parent::__construct($this->_helper->getSmtpHost(), $this->_helper->getTransportConfig());
 }
 public function __construct($parameters = null)
 {
     if ($parameters instanceof Zend_Config) {
         $parameters = $parameters->toArray();
     }
     $hostName = isset($parameters['host']) ? $parameters['host'] : null;
     unset($parameters['host']);
     parent::__construct($hostName, $parameters);
 }
 /**
  *
  *
  * @param \Shockwavemk\Mail\Smtp\Model\Config $config
  * @param \Magento\Framework\Mail\MessageInterface $message
  * @param \Magento\Framework\Stdlib\DateTime $dateTime
  * @param null $parameters
  * @throws \InvalidArgumentException
  */
 public function __construct(\Shockwavemk\Mail\Smtp\Model\Config $config, \Magento\Framework\Mail\MessageInterface $message, \Magento\Framework\Stdlib\DateTime $dateTime, $parameters = null)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     parent::__construct($config->getHost(), $config->getSmtpParameters());
     $this->_message = $message;
     $this->_dateTime = $dateTime;
 }
 /**
  * @param MessageInterface $message
  * @param null $parameters
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @throws \InvalidArgumentException
  */
 public function __construct(\Magento\Framework\Mail\MessageInterface $message, \Emizentech\CustomSmtp\Helper\Data $dataHelper)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     $smtpHost = $dataHelper->getConfigSmtpHost();
     $smtpConf = ['auth' => strtolower($dataHelper->getConfigAuth()), 'ssl' => $dataHelper->getConfigSsl(), 'username' => $dataHelper->getConfigUsername(), 'password' => $dataHelper->getConfigPassword(), 'port' => $dataHelper->getConfigPort()];
     parent::__construct($smtpHost, $smtpConf);
     $this->_message = $message;
 }
Beispiel #7
0
 /**
  *
  * @param MessageInterface $message
  * @param array $config
  * @throws \InvalidArgumentException
  */
 public function __construct(MessageInterface $message, array $config)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     $host = 'smtp.gmail.com';
     $options = ['username' => $config['user'], 'password' => $config['password'], 'auth' => 'login', 'port' => 465, 'ssl' => 'SSL'];
     parent::__construct($host, $options);
     $this->message = $message;
 }
Beispiel #8
0
 /**
  *
  * @param MessageInterface $message
  * @param array $config
  * @throws \InvalidArgumentException
  */
 public function __construct(MessageInterface $message, array $config)
 {
     if (!$message instanceof \Zend_Mail) {
         throw new \InvalidArgumentException('The message should be an instance of \\Zend_Mail');
     }
     $host = $config['host'];
     $options = ['auth' => $config['auth'], 'username' => $config['user'], 'password' => $config['password'], 'port' => $config['port']];
     $ssl = $this->getSsl($config['secure']);
     if ($ssl) {
         $options['ssl'] = $ssl;
     }
     parent::__construct($host, $options);
     $this->message = $message;
 }
Beispiel #9
0
 /**
  * Create a new Zend_Mail_Transport instance.
  */
 public function __construct($config = null)
 {
     $smtp = 'localhost';
     if (isset($config->smtp)) {
         $smtp = $config->smtp;
     }
     $port = 25;
     if (isset($config->port)) {
         $port = $config->port;
     }
     $logger = Zend_Registry::get('Zend_Log');
     $logger->info("Opus_Mail_Transport: Using mail server {$smtp}:{$port}");
     parent::__construct($smtp, array('port' => $port));
 }
Beispiel #10
0
 /**
  * Constructor.
  *
  * @param  string $endpoint (Default: smtp.sendgrid.net)
  * @param  array|null $config (Default: null)
  * @return void
  * @throws Zend_Mail_Transport_Exception if username is not present in the config
  * @throws Zend_Mail_Transport_Exception if password is not present in the config
  */
 public function __construct(array $config = array(), $host = 'smtp.sendgrid.net')
 {
     if (array_key_exists('username', $config)) {
         $this->_username = $config['username'];
     } else {
         $this->_username = SENDGRID_USERNAME;
     }
     if (array_key_exists('password', $config)) {
         $this->_password = $config['password'];
     } else {
         $this->_password = SENDGRID_PASSWD;
     }
     if (empty($this->_username)) {
         throw new Zend_Mail_Transport_Exception('This transport requires the Sendgrid username');
     }
     if (empty($this->_password)) {
         throw new Zend_Mail_Transport_Exception('This transport requires the Sendgrid password');
     }
     $config['username'] = $this->_username;
     $config['password'] = $this->_password;
     $config['auth'] = 'plain';
     $config['port'] = '587';
     parent::__construct($host, $config);
 }