Skip to content
Extraits de code Groupes Projets
Valider 41a0caca rédigé par robocoder's avatar robocoder
Parcourir les fichiers

fixes #1676 - add "SMTP encryption" selection in General Settings which sets...

fixes #1676 - add "SMTP encryption" selection in General Settings which sets the 'ssl' option in the transport-layer.  Added some more help text.


git-svn-id: http://dev.piwik.org/svn/trunk@3268 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 9c6d1e3f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -253,12 +253,13 @@ ip_address_mask_length = 1 ...@@ -253,12 +253,13 @@ ip_address_mask_length = 1
;trusted_proxy_addresses[] = ;trusted_proxy_addresses[] =
[mail] [mail]
transport = ; smtp or empty transport = ; smtp (using the configuration below) or empty (using built-in mail() function)
port = 25 port = ; optional; defaults to 25 when security is none or tls; 465 for ssl
host = ; SMTP server address host = ; SMTP server address
type = ; SMTP Auth type. By default: NONE. For example: LOGIN type = ; SMTP Auth type. By default: NONE. For example: LOGIN
username = ; SMTP username username = ; SMTP username
password = ; SMTP password password = ; SMTP password
encryption = ; SMTP transport-layer encryption, either 'ssl', 'tls', or empty (i.e., none).
[log] [log]
;possible values for log: screen, database, file ;possible values for log: screen, database, file
......
...@@ -49,15 +49,17 @@ class Piwik_Mail extends Zend_Mail ...@@ -49,15 +49,17 @@ class Piwik_Mail extends Zend_Mail
return; return;
} }
$smtpConfig = array(); $smtpConfig = array();
if ( !empty($config->auth->type) if ( !empty($config->type)
|| !empty($config->auth->username) || !empty($config->username)
|| !empty($config->auth->password) || !empty($config->password)
|| !empty($config->security)
) )
{ {
$smtpConfig = array( $smtpConfig = array(
'auth' => $config->auth->type, 'auth' => $config->type,
'username' => $config->auth->username, 'username' => $config->username,
'password' => $config->auth->password 'password' => $config->password,
'ssl' => $config->security,
); );
} }
......
...@@ -204,11 +204,14 @@ $translations = array( ...@@ -204,11 +204,14 @@ $translations = array(
'General_AuthenticationMethodSmtp' => 'Authentication method for SMTP', 'General_AuthenticationMethodSmtp' => 'Authentication method for SMTP',
'General_SmtpUsername' => 'SMTP username', 'General_SmtpUsername' => 'SMTP username',
'General_SmtpPassword' => 'SMTP password ', 'General_SmtpPassword' => 'SMTP password ',
'General_SmtpEncryption' => 'SMTP encryption',
'General_SelectYesIfYouWantToSendEmailsViaServer' => 'Select "Yes" if you want or have to send e-mail via a named server instead of the local mail function', 'General_SelectYesIfYouWantToSendEmailsViaServer' => 'Select "Yes" if you want or have to send e-mail via a named server instead of the local mail function',
'General_OptionalSmtpPort' => 'Optional. Defaults to 25 for unencrypted and TLS SMTP, and 465 for SSL SMTP.',
'General_OnlyUsedIfUserPwdIsSet' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'General_OnlyUsedIfUserPwdIsSet' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.',
'General_OnlyEnterIfRequired' => 'Only enter a username if your SMTP server requires it', 'General_OnlyEnterIfRequired' => 'Only enter a username if your SMTP server requires it.',
'General_OnlyEnterIfRequiredPassword' => 'Only enter a password if your SMTP server requires it', 'General_OnlyEnterIfRequiredPassword' => 'Only enter a password if your SMTP server requires it.',
'General_WarningPasswordStored' => '%sWarning:%s This password will be stored in the config file visible to everybody how can access it.', 'General_WarningPasswordStored' => '%sWarning:%s This password will be stored in the config file visible to everybody how can access it.',
'General_EncryptedSmtpTransport' => 'Enter the transport layer encryption required by your SMTP server.',
'General_InvalidResponse' => 'The received data is invalid.', 'General_InvalidResponse' => 'The received data is invalid.',
'General_ChooseLanguage' => 'Choose language', 'General_ChooseLanguage' => 'Choose language',
'General_ChoosePeriod' => 'Choose period', 'General_ChoosePeriod' => 'Choose period',
......
...@@ -64,11 +64,12 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller ...@@ -64,11 +64,12 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller
// Update email settings // Update email settings
$mail = Zend_Registry::get('config')->mail; $mail = Zend_Registry::get('config')->mail;
$mail->transport = (Piwik_Common::getRequestVar('mailUseSmtp') == '1') ? 'smtp' : ''; $mail->transport = (Piwik_Common::getRequestVar('mailUseSmtp') == '1') ? 'smtp' : '';
$mail->port = Piwik_Common::getRequestVar('mailPort', 25); $mail->port = Piwik_Common::getRequestVar('mailPort', '');
$mail->host = Piwik_Common::getRequestVar('mailHost', ''); $mail->host = Piwik_Common::getRequestVar('mailHost', '');
$mail->type = Piwik_Common::getRequestVar('mailType', ''); $mail->type = Piwik_Common::getRequestVar('mailType', '');
$mail->username = Piwik_Common::getRequestVar('mailUsername', ''); $mail->username = Piwik_Common::getRequestVar('mailUsername', '');
$mail->password = Piwik_Common::getRequestVar('mailPassword', ''); $mail->password = Piwik_Common::getRequestVar('mailPassword', '');
$mail->encryption = Piwik_Common::getRequestVar('mailEncryption', '');
Zend_Registry::get('config')->mail = $mail->toArray(); Zend_Registry::get('config')->mail = $mail->toArray();
$toReturn = $response->getResponse(); $toReturn = $response->getResponse();
...@@ -77,5 +78,4 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller ...@@ -77,5 +78,4 @@ class Piwik_CoreAdminHome_Controller extends Piwik_Controller
} }
echo $toReturn; echo $toReturn;
} }
} }
...@@ -24,6 +24,7 @@ function getGeneralSettingsAJAX() ...@@ -24,6 +24,7 @@ function getGeneralSettingsAJAX()
request += '&mailType=' + $('#mailType').val(); request += '&mailType=' + $('#mailType').val();
request += '&mailUsername=' + $('#mailUsername').val(); request += '&mailUsername=' + $('#mailUsername').val();
request += '&mailPassword=' + $('#mailPassword').val(); request += '&mailPassword=' + $('#mailPassword').val();
request += '&mailEncryption=' + $('#mailEncryption').val();
ajaxRequest.data = request; ajaxRequest.data = request;
return ajaxRequest; return ajaxRequest;
} }
...@@ -60,4 +61,3 @@ $(document).ready( function() { ...@@ -60,4 +61,3 @@ $(document).ready( function() {
} }
) )
}); });
...@@ -73,7 +73,8 @@ ...@@ -73,7 +73,8 @@
<td style='width:200px'><input type="text" id="mailHost" value="{$mail.host}"></td> <td style='width:200px'><input type="text" id="mailHost" value="{$mail.host}"></td>
</tr> </tr>
<tr> <tr>
<td><label for="mailPort">{'General_SmtpPort'|translate}</label></td> <td><label for="mailPort">{'General_SmtpPort'|translate}</label><br>
<span class="form-description">{'General_OptionalSmtpPort'|translate}</i></td>
<td><input type="text" id="mailPort" value="{$mail.port}"></td> <td><input type="text" id="mailPort" value="{$mail.port}"></td>
</tr> </tr>
<tr> <tr>
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
<span class="form-description">{'General_OnlyUsedIfUserPwdIsSet'|translate}</span> <span class="form-description">{'General_OnlyUsedIfUserPwdIsSet'|translate}</span>
</td> </td>
<td> <td>
<select id="mailType" > <select id="mailType">
<option value="" {if $mail.type eq ''} selected="selected" {/if}></option> <option value="" {if $mail.type eq ''} selected="selected" {/if}></option>
<option id="plain" {if $mail.type eq 'PLAIN'} selected="selected" {/if} value="PLAIN">PLAIN</option> <option id="plain" {if $mail.type eq 'PLAIN'} selected="selected" {/if} value="PLAIN">PLAIN</option>
<option id="login" {if $mail.type eq 'LOGIN'} selected="selected" {/if} value="LOGIN"> LOGIN</option> <option id="login" {if $mail.type eq 'LOGIN'} selected="selected" {/if} value="LOGIN"> LOGIN</option>
...@@ -107,6 +108,17 @@ ...@@ -107,6 +108,17 @@
<input type="password" id="mailPassword" value = "{$mail.password}" > <input type="password" id="mailPassword" value = "{$mail.password}" >
</td> </td>
</tr> </tr>
<tr>
<td><label for="mailEncryption">{'General_SmtpEncryption'|translate}</label><br>
<span class="form-description">{'General_EncryptedSmtpTransport'|translate}</i></td>
<td>
<select id="mailEncryption">
<option value="" {if $mail.encryption eq ''} selected="selected" {/if}></option>
<option id="ssl" {if $mail.encryption eq 'ssl'} selected="selected" {/if} value="ssl">SSL</option>
<option id="tls" {if $mail.encryption eq 'tls'} selected="selected" {/if} value="tls">TLS</option>
</select>
</td>
</tr>
</table> </table>
</div> </div>
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter