mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-09 08:05:13 +02:00
Socks proxy support
This commit is contained in:
@ -15,6 +15,8 @@ import imaplib
|
||||
import mimetypes
|
||||
import poplib
|
||||
import re
|
||||
import socks
|
||||
import socket
|
||||
|
||||
from datetime import timedelta
|
||||
from email.header import decode_header
|
||||
@ -84,6 +86,17 @@ def process_queue(q, quiet=False):
|
||||
if not quiet:
|
||||
print "Processing: %s" % q
|
||||
|
||||
if q.socks_proxy_type and q.socks_proxy_host and q.socks_proxy_port:
|
||||
proxy_type = {
|
||||
'socks4': socks.SOCKS4,
|
||||
'socks5': socks.SOCKS5,
|
||||
}.get(q.socks_proxy_type)
|
||||
|
||||
socks.set_default_proxy(proxy_type=proxy_type, addr=q.socks_proxy_host, port=q.socks_proxy_port)
|
||||
socket.socket = socks.socksocket
|
||||
else:
|
||||
socket.socket = socket._socketobject
|
||||
|
||||
email_box_type = settings.QUEUE_EMAIL_BOX_TYPE if settings.QUEUE_EMAIL_BOX_TYPE else q.email_box_type
|
||||
|
||||
if email_box_type == 'pop3':
|
||||
|
Reference in New Issue
Block a user