Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
0405136f
Commit
0405136f
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add support for new MailFetcher init
parent
2a35c5a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.email.php
+46
-24
46 additions, 24 deletions
include/class.email.php
with
46 additions
and
24 deletions
include/class.email.php
+
46
−
24
View file @
0405136f
...
...
@@ -98,6 +98,27 @@ class Email {
return
$this
->
getHashtable
();
}
function
getMailAccountInfo
()
{
/*NOTE: Do not change any of the tags - otherwise mail fetching will fail */
$info
=
array
(
//Mail server info
'host'
=>
$this
->
ht
[
'mail_host'
],
'port'
=>
$this
->
ht
[
'mail_port'
],
'protocol'
=>
$this
->
ht
[
'mail_protocol'
],
'encryption'
=>
$this
->
ht
[
'mail_encryption'
],
'username'
=>
$this
->
ht
[
'userid'
],
'password'
=>
Mcrypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
),
//osTicket specific
'email_id'
=>
$this
->
getId
(),
//Required for email routing to work.
'max_fetch'
=>
$this
->
ht
[
'mail_fetchmax'
],
'delete_mail'
=>
$this
->
ht
[
'mail_delete'
],
'archive_folder'
=>
$this
->
ht
[
'mail_archivefolder'
]
);
return
$info
;
}
function
isSMTPEnabled
()
{
return
$this
->
ht
[
'smtp_active'
];
}
...
...
@@ -106,17 +127,15 @@ class Email {
return
(
$this
->
ht
[
'smtp_spoofing'
]);
}
function
getSMTPInfo
(
$active
=
true
)
{
$info
=
array
();
if
(
!
$active
||
(
$active
&&
$this
->
isSMTPEnabled
()))
{
$info
=
array
(
'host'
=>
$this
->
ht
[
'smtp_host'
],
'port'
=>
$this
->
ht
[
'smtp_port'
],
'auth'
=>
$this
->
ht
[
'smtp_auth'
],
'username'
=>
$this
->
ht
[
'userid'
],
'password'
=>
Mcrypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
)
);
}
function
getSMTPInfo
()
{
$info
=
array
(
'host'
=>
$this
->
ht
[
'smtp_host'
],
'port'
=>
$this
->
ht
[
'smtp_port'
],
'auth'
=>
$this
->
ht
[
'smtp_auth'
],
'username'
=>
$this
->
ht
[
'userid'
],
'password'
=>
Mcrypt
::
decrypt
(
$this
->
ht
[
'userpass'
],
SECRET_SALT
)
);
return
$info
;
}
...
...
@@ -207,12 +226,12 @@ class Email {
$vars
=
$vars
;
$vars
[
'cpasswd'
]
=
$this
->
getPasswd
();
//Current decrypted password.
if
(
$this
->
save
(
$this
->
getId
(),
$vars
,
$errors
))
{
$this
->
reload
();
return
true
;
}
if
(
!
$this
->
save
(
$this
->
getId
(),
$vars
,
$errors
))
return
false
;
return
false
;
$this
->
reload
();
return
true
;
}
...
...
@@ -341,11 +360,8 @@ class Email {
if
(
!
isset
(
$vars
[
'postfetch'
]))
$errors
[
'postfetch'
]
=
'Indicate what to do with fetched emails'
;
elseif
(
!
strcasecmp
(
$vars
[
'postfetch'
],
'archive'
))
{
if
(
!
$vars
[
'mail_archivefolder'
])
$errors
[
'postfetch'
]
=
'Valid folder required'
;
}
elseif
(
!
strcasecmp
(
$vars
[
'postfetch'
],
'archive'
)
&&
!
$vars
[
'mail_archivefolder'
]
)
$errors
[
'postfetch'
]
=
'Valid folder required'
;
}
if
(
$vars
[
'smtp_active'
])
{
...
...
@@ -370,10 +386,16 @@ class Email {
$passwd
=
$vars
[
'passwd'
]
?
$vars
[
'passwd'
]
:
$vars
[
'cpasswd'
];
if
(
!
$errors
&&
$vars
[
'mail_active'
])
{
//note: password is unencrypted at this point...MailFetcher expect plain text.
$fetcher
=
new
MailFetcher
(
$vars
[
'userid'
],
$passwd
,
$vars
[
'mail_host'
],
$vars
[
'mail_port'
],
$vars
[
'mail_protocol'
],
$vars
[
'mail_encryption'
]);
$fetcher
=
new
MailFetcher
(
array
(
'host'
=>
$vars
[
'mail_host'
],
'port'
=>
$vars
[
'mail_port'
],
'username'
=>
$vars
[
'userid'
],
'password'
=>
$passwd
,
'protocol'
=>
$vars
[
'mail_protocol'
],
'encryption'
=>
$vars
[
'mail_encryption'
])
);
if
(
!
$fetcher
->
connect
())
{
$errors
[
'err'
]
=
'Invalid login. Check '
.
Format
::
htmlchars
(
$vars
[
'mail_protocol'
])
.
' settings'
;
$errors
[
'mail'
]
=
'<br>'
.
$fetcher
->
getLastError
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment