MagePal\GmailSmtpApp\Helper\Data::getConfigSmtpPort PHP Method

getConfigSmtpPort() public method

Get system config port
public getConfigSmtpPort ( $store_id = null ) : string
return string
    public function getConfigSmtpPort($store_id = null)
    {
        return $this->scopeConfig->getValue('system/gmailsmtpapp/smtpport', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store_id);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @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;
 }