smtp: Reuse existing connections where possible

This should speed up the system where several emails and alerts will be sent
through the same SMTP account in the same request.
tnef: Improve performance of checksum checks

Previously, the data blocks were inspected byte for byte. Now data blocks
are parsed 1k at a time. Fewer PHP function calls ultimately means faster
performance.
tnef: Support TNEF for fetched emails
Add delivered-to detection to mail fetcher

Duplicate delivered-to handling from mail parse as temp. solution.
pipe: Honor attachment ext and size restrictions
auth: Forbid password reset for non-local users

Also allow an administrator to lift the force password change flag without
specifying a new password.
Register session close on shutdown at the start of session handling

This is necessary to make sure session data is saved on redirect.
fetch: Consider all delivered-to headers
Merge pull request #567 from greezybacon/issue/tnef-mail-fetch

tnef: Support TNEF for fetched emails

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #462 from greezybacon/issue/reuse-smtp-conns

smtp: Reuse existing connections where possible

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #568 from greezybacon/issue/mail-parse-file-exts

pipe: Honor attachment ext and size restrictions

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge pull request #565 from protich/feature/delivered-to+mailfetch

Add delivered-to detection to mail fetcher

Reviewed-By: Jared Hancock <jared@osticket.com>
Merge pull request #571 from protich/issue/close_session_on_shutdown

Register session close on shutdown at the start of session handling

Reviewed-By: Jared Hancock <jared@osticket.com>
Merge pull request #570 from greezybacon/issue/non-local-staff-pwreset

auth: Forbid password reset for non-local users

Reviewed-By: Peter Rotich <peter@osticket.com>
filter: Implement priority action

The priority setting was broken when priority was added to the dynamic data
Merge pull request #574 from greezybacon/issue/honor-filter-priority

filter: Implement priority 

Reviewed-By: Peter Rotich <peter@osticket.com>
Merge remote branch 'upstream/develop' into develop-next
Merge remote branch 'upstream/develop-next' into develop-next
Destroy staff session on logout