Skip to content

Commit

Permalink
Merge pull request #22 from magepal/c3limited-master
Browse files Browse the repository at this point in the history
Issues #19 - Add smtp port option
  • Loading branch information
srenon authored Sep 7, 2016
2 parents eb266a1 + 885f5c2 commit e571543
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Controller/Adminhtml/Test/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public function execute() {
'auth' => strtolower($request->getPost('auth')),
'ssl' => $request->getPost('ssl'),
'username' => $username,
'password' => $password
'password' => $password,
'port' => $request->getPost('smtpport')
);

$transport = new \Zend_Mail_Transport_Smtp($smtpHost, $smtpConf);
Expand Down
14 changes: 12 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getConfigUsername($store_id = null){
}

/**
* Get system config password
* Get system config auth
*
* @param \Magento\Store\Model\ScopeInterface::SCOPE_STORE $store
* @return string
Expand All @@ -67,14 +67,24 @@ public function getConfigSsl($store_id = null){
}

/**
* Get system config password
* Get system config host
*
* @param \Magento\Store\Model\ScopeInterface::SCOPE_STORE $store
* @return string
*/
public function getConfigSmtpHost($store_id = null){
return $this->scopeConfig->getValue('system/gmailsmtpapp/smtphost', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store_id);
}

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

/**
* Get system config reply to
Expand Down
3 changes: 2 additions & 1 deletion Model/Transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function __construct(\Magento\Framework\Mail\MessageInterface $message, \
'auth' => strtolower($dataHelper->getConfigAuth()),
'ssl' => $dataHelper->getConfigSsl(),
'username' => $dataHelper->getConfigUsername(),
'password' => $dataHelper->getConfigPassword()
'password' => $dataHelper->getConfigPassword(),
'port' => $dataHelper->getConfigSmtpPort(),
];


Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"magento/framework": "100.0.*|100.1.*"
},
"type": "magento2-module",
"version": "1.2.0",
"version": "1.3.0",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
6 changes: 6 additions & 0 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<label>SMTP Host</label>
<comment>Use "smtp.gmail.com" for Gmail or Google Apps.</comment>
</field>
<field id="smtpport" translate="label" type="text" sortOrder="17" showInDefault="1" showInWebsite="1" showInStore="1">
<label>SMTP Port</label>
<validate>validate-number</validate>
<frontend_class>validate-number</frontend_class>
<comment>Use 465 (ssl) or 587 (tls) if port 25 is throttled or blocked.</comment>
</field>
<field id="username" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Username</label>
<comment>Email Address.</comment>
Expand Down
1 change: 1 addition & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ssl>ssl</ssl>
<auth>LOGIN</auth>
<smtphost>smtp.gmail.com</smtphost>
<smtpport>465</smtpport>
<set_return_path>1</set_return_path>
<set_reply_to>1</set_reply_to>
<password backend_model="Magento\Config\Model\Config\Backend\Encrypted" />
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MagePal_GmailSmtpApp" setup_version="1.2.0">
<module name="MagePal_GmailSmtpApp" setup_version="1.3.0">
<sequence>
<module name="Magento_Email"/>
</sequence>
Expand Down
1 change: 1 addition & 0 deletions view/adminhtml/templates/system/config/testbutton.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ $jsonHelper = $this->helper('Magento\Framework\Json\Helper\Data');
auth: $('#system_gmailsmtpapp_auth').val(),
ssl:$('#system_gmailsmtpapp_ssl').val(),
smtphost:$('#system_gmailsmtpapp_smtphost').val(),
smtpport:$('#system_gmailsmtpapp_smtpport').val(),
username:$('#system_gmailsmtpapp_username').val(),
password:$('#system_gmailsmtpapp_password').val(),
email:$('#system_gmailsmtpapp_debug_email').val(),
Expand Down

0 comments on commit e571543

Please sign in to comment.