* finish task #3480.

This commit is contained in:
wangyidong
2017-12-18 10:34:34 +08:00
parent 020acf5f43
commit 5dab74c631
5 changed files with 18 additions and 7 deletions
+11 -6
View File
@@ -55,21 +55,26 @@ class mail extends control
* @access public
* @return void
*/
public function detect()
public function detect($type = 'smtp')
{
if($_POST)
if($_POST or $type == 'gmail')
{
set_time_limit(30);
$error = '';
if($this->post->fromAddress == false) $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress);
if(!validater::checkEmail($this->post->fromAddress)) $error .= '\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress);
if($type != 'gmail')
{
$error = '';
if($this->post->fromAddress == false) $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress);
if(!validater::checkEmail($this->post->fromAddress)) $error .= '\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress);
if($error) die(js::alert($error));
if($error) die(js::alert($error));
}
if($type == 'gmail' and empty($_POST['fromAddress'])) $_POST['fromAddress'] = '@gmail.com';
echo "<script>setTimeout(function(){parent.location.href='" . inlink('edit') . "'}, 10000)</script>";
$mailConfig = $this->mail->autoDetect($this->post->fromAddress);
$mailConfig->fromAddress = $this->post->fromAddress;
$mailConfig->domain = common::getSysURL();
if($type == 'gmail') $mailConfig->fromAddress = '';
$this->session->set('mailConfig', $mailConfig);
die(js::locate(inlink('edit'), 'parent'));
+2 -1
View File
@@ -1,4 +1,5 @@
$(document).ready()
{
$('#password').focus();
$('#fromAddress').focus();
if($('#fromAddress').val() != '')$('#password').focus();
}
+1
View File
@@ -10,6 +10,7 @@ $lang->mail->resend = 'Resend';
$lang->mail->browse = 'Email List';
$lang->mail->delete = 'Delete Email';
$lang->mail->ztCloud = 'ZenTao CloudMail';
$lang->mail->gmail = 'GMAIL';
$lang->mail->sendCloud = 'Notice SendCloud';
$lang->mail->batchDelete = 'Batch Delete';
$lang->mail->sendcloudUser = 'Sync Contact';
+1
View File
@@ -10,6 +10,7 @@ $lang->mail->resend = '重发';
$lang->mail->browse = '邮件列表';
$lang->mail->delete = '删除邮件';
$lang->mail->ztCloud = '禅道云发信';
$lang->mail->gmail = 'GMAIL发信';
$lang->mail->sendCloud = 'Notice发信';
$lang->mail->batchDelete = '批量删除';
$lang->mail->sendcloudUser = '同步联系人';
+3
View File
@@ -24,6 +24,9 @@ include '../../common/view/header.html.php';
<?php if($this->app->getClientLang() != 'en' and common::hasPriv('mail', 'ztCloud')):?>
<?php echo html::a(inlink('ztCloud'), $lang->mail->ztCloud, '', "class='btn btn-sm w-120px'")?>
<?php endif;?>
<?php if($this->app->getClientLang() == 'en'):?>
<?php echo html::a(inlink('detect', 'type=gmail'), $lang->mail->gmail, '', "class='btn btn-sm w-120px'")?>
<?php endif;?>
<?php if(common::hasPriv('mail', 'detect')):?>
<?php echo html::a(inlink('detect'), $lang->mail->smtp, '', "class='btn btn-sm w-120px'")?>
<?php endif;?>