Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     sys.stdout = codecs.getwriter('utf8')(sys.stdout)
     sys.stderr = codecs.getwriter('utf8')(sys.stderr)
     print(
         'Debug email server is running. Now you can send emails to SMTP localhost:10250.'
     )
Ejemplo n.º 2
0
    def __init__(self, laddr, raddr, uilogger):
        SMTPServer.__init__(self, laddr, raddr)
        self.uilogger = uilogger

        self.ib_clients = dict()  # a dict to reference different client by account id
        self.em_clients = list()  # list of emails only clients
        self.ems = None           # email sender object
        self.slack = None         # slack client

        # Retrieve application config from app.yml to initialize emailsender and slack
        with open('conf/app.yml', 'r') as cf:
            conf = yaml.load(cf, Loader=yaml.FullLoader)

        if "email_sender" in conf:
            self.ems = EmailSender(
                                    conf["email_sender"]["smtp_server"],
                                    conf["email_sender"]["smtp_port"],
                                    conf["email_sender"]["sender"],
                                    self.uilogger
                                  )
        if "slack" in conf:
            self.slack = Slack(
                               conf['slack']['webhook_path'],
                               url=conf['slack']['webhook_url'],
                               channel=conf['slack']['channel'],
                               username=conf['slack']['username'],
                               icon=conf['slack']['icon']
                             )
Ejemplo n.º 3
0
    def __init__(self, localaddr, db_config, drop_publisher, cf_options):
        SMTPServer.__init__(self, localaddr, None)

        self.drop_publisher = drop_publisher
        self.db_config = db_config
        self.db = None
        self.cf_options = cf_options
Ejemplo n.º 4
0
    def __init__(self, localaddr, db_config, api_url, api_key):
        SMTPServer.__init__(self, localaddr, None)

        self.db_config = db_config
        self.api_url = api_url
        self.api_key = api_key
        self.h = Http()
        self.db = None
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     self.set_reuse_addr()
     fcntl.fcntl(
         self.socket.fileno(), fcntl.F_SETFD,
         fcntl.fcntl(self.socket.fileno(), fcntl.F_GETFD)
         | fcntl.FD_CLOEXEC)
     self.data = []
Ejemplo n.º 6
0
    def __init__(self, localaddr, db_config, api_url, api_key):
        SMTPServer.__init__(self, localaddr, None)

        self.db_config = db_config
        self.api_url = api_url
        self.api_key = api_key
        self.h = Http()
        self.db = None
Ejemplo n.º 7
0
 def __init__(self, localaddr, remoteaddr, outputdir, debug=False):
     '''Initialise'''
     self.outputdir = outputdir
     self.debug = debug
     if not (os.path.exists(outputdir) and os.path.isdir(outputdir)):
         raise ValueError(
             'Provided output dir does not exist or is not a directory')
     SMTPServer.__init__(self, localaddr, remoteaddr)
Ejemplo n.º 8
0
 def __init__(self, address_or_socket, authenticator=SMTPAuth()):
     if callable(getattr(address_or_socket, 'listen', None)):
         asyncore.dispatcher.__init__(self)
         address_or_socket.setblocking(0)
         self.set_socket(address_or_socket)
     else:
         BaseSMTPServer.__init__(self, address_or_socket, None)
     self.authenticator = authenticator
     self.parser = Parser()
Ejemplo n.º 9
0
 def __init__(self, address_or_socket, authenticator=SMTPAuth()):
     if callable(getattr(address_or_socket, 'listen', None)):
         asyncore.dispatcher.__init__(self)
         address_or_socket.setblocking(0)
         self.set_socket(address_or_socket)
     else:
         BaseSMTPServer.__init__(self, address_or_socket, None)
     self.authenticator = authenticator
     self.parser = Parser()
Ejemplo n.º 10
0
    def __init__(self, localaddr, remoteaddr):
        SMTPServer.__init__(self, localaddr, remoteaddr)

        with open('sendgrid_key', 'r+') as content_file:
            data = content_file.read().strip()

            if data is None or data == '':
                print('No API key set in the file: sendgrid_key')
                exit(1)

            print('Sendgrid API key read from storage')
            self.apikey = data
Ejemplo n.º 11
0
    def __init__(self, localaddr, remoteaddr, output_dir=None, convert=False,
                 log_via=None):
        SMTPServer.__init__(self, localaddr, None)

        if not output_dir:
            output_dir = '.'
        self.output_dir = output_dir

        self.convert = convert

        if not log_via:
            log_via = 'stdio'
        self.log_via = log_via
Ejemplo n.º 12
0
    def __init__(self, host='127.0.0.1', port=2526):
        # Initialize the SMTP component.
        # My face that asyncore doesn't use new style classes!
        SMTPServer.__init__(self, (host, port), None)

        # Retrieve the actually-bound socket address. May, in some circumstances, use a reverse DNS name.
        if self._localaddr[1] == 0:
            self.address = self.socket.getsockname()
        else:
            self.address = (host, port)

        # Create a place to store messages.
        self.messages = deque()

        # Setup threading.
        self._stop = Event()
        self._lock = RLock()
        Thread.__init__(self, name=self.__class__.__name__)
Ejemplo n.º 13
0
	def __init__(self, host='127.0.0.1', port=2526):
		# Initialize the SMTP component.
		# My face that asyncore doesn't use new style classes!
		SMTPServer.__init__(self, (host, port), None)
		
		# Retrieve the actually-bound socket address. May, in some circumstances, use a reverse DNS name.
		if self._localaddr[1] == 0:
			self.address = self.socket.getsockname()
		else:
			self.address = (host, port)
		
		# Create a place to store messages.
		self.messages = deque()
		
		# Setup threading.
		self._stop = Event()
		self._lock = RLock()
		Thread.__init__(self, name=self.__class__.__name__)
Ejemplo n.º 14
0
 def __init__(self, localaddr, remoteaddr):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.mboxes = defaultdict(Mailbox)
 def __init__(self, localaddr, remoteaddr, queue):
     self._localaddr = localaddr
     self._remoteaddr = remoteaddr
     self._queue = queue
     SMTPServer.__init__(self, localaddr, remoteaddr)
Ejemplo n.º 16
0
 def __init__(self, *args, **kwargs):
     threading.Thread.__init__(self)
     SMTPServer.__init__(self, *args, **kwargs)
     self.active_lock = threading.Lock()
     self.active = False
     self.daemon = True
Ejemplo n.º 17
0
 def __init__(self, output_connection):
     SMTPServer.__init__(self, ('localhost', 8001), None)
     self.output_connection = output_connection
Ejemplo n.º 18
0
 def __init__(self):
     SMTPServer.__init__(self, ('0.0.0.0', 25), None)
Ejemplo n.º 19
0
 def __init__(self, localaddr, queue):
     SMTPServer.__init__(self, localaddr, None)
     self.queue = queue
Ejemplo n.º 20
0
 def __init__(self, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     self.callbacks = []
Ejemplo n.º 21
0
 def __init__(self, logger, localaddr, remoteaddr):
     self.logger = logger
     SMTPServer.__init__(self, localaddr, remoteaddr)
Ejemplo n.º 22
0
    def __init__(self):
        localaddr = (settings['lmtpd_host'], settings['lmtpd_port'])
        SMTPServer.__init__(self, localaddr, None)

        self.db_connect()
Ejemplo n.º 23
0
 def __init__(self, outgoing, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     self.outgoing = outgoing
     self.log = open("IncomingServer.log", "w")
Ejemplo n.º 24
0
 def __init__(self, localaddr, remoteaddr):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.number = 0
Ejemplo n.º 25
0
 def __init__(self, localaddr, remoteaddr):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.mboxes = defaultdict(Mailbox)
Ejemplo n.º 26
0
 def __init__(self, *args, **kwargs):
     self.store = kwargs.pop('store')
     SMTPServer.__init__(self, *args, **kwargs)
Ejemplo n.º 27
0
 def __init__(self, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     #TODO: lock self._messages?
     self._messages = []
Ejemplo n.º 28
0
 def __init__(self, localaddr, remoteaddr, saveobj, logobj):
     self.capture = saveobj
     self.message = logobj
     SMTPServer.__init__(self, localaddr, remoteaddr)
Ejemplo n.º 29
0
 def __init__(self, laddr, raddr, uilogger):
     SMTPServer.__init__(self, laddr, raddr)
     self.uilogger = uilogger
Ejemplo n.º 30
0
 def __init__(self, path, *args, **kwargs):
     self.path = path
     self.counter = count(1)
     # smtpd.SMTPServer is still on old-school class on 2.7
     SMTPServer.__init__(self, *args, **kwargs)
Ejemplo n.º 31
0
 def __init__(self, localaddr, remoteaddr, maildir):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.maildir = maildir
 def run(self):
     SMTPServer.__init__(self, (self.host, self.port), None)
     try:
         asyncore.loop()
     except KeyboardInterrupt:
         pass
Ejemplo n.º 33
0
 def __init__(self, outgoing, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     self.outgoing = outgoing
     self.log = open("IncomingServer.log", "w")
Ejemplo n.º 34
0
 def __init__(self, host, port):
     self.msgs = []
     SMTPServer.__init__(self, (host, port), None)
Ejemplo n.º 35
0
 def __init__(self, localaddr, remoteaddr, fail, channel):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.fail = fail
     self.channel = channel
Ejemplo n.º 36
0
 def __init__(self, localaddr, queue):
     SMTPServer.__init__(self, localaddr, None)
     self.queue = queue
Ejemplo n.º 37
0
 def __init__(self, localaddr, remoteaddr, logger):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.log = logger
Ejemplo n.º 38
0
  def __init__(self, localaddr, remoteaddr):
    SMTPServer.__init__(self, localaddr, remoteaddr)
    self.processor = RaindropEmailProcessor()

    self.hbase = RaindropHBaseClient()
Ejemplo n.º 39
0
 def __init__(self, *args, **kwargs):
     self.store = kwargs.pop('store')
     SMTPServer.__init__(self, *args, **kwargs)
Ejemplo n.º 40
0
 def __init__(self, localaddr, remoteaddr):
     SMTPServer.__init__(self, localaddr, remoteaddr)
Ejemplo n.º 41
0
 def run(self):
     SMTPServer.__init__(self, (self.host, self.port), None)
     try:
         asyncore.loop()
     except KeyboardInterrupt:
         pass
Ejemplo n.º 42
0
 def __init__(self, localaddr, remoteaddr, queue):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.queue = queue
Ejemplo n.º 43
0
 def __init__(self, app, bindaddr, port):
     SMTPServer.__init__(self, (bindaddr, port), None)
     self.app = app
Ejemplo n.º 44
0
 def __init__(self, *args, **kwargs):
     SMTPServer.__init__(self, *args, **kwargs)
     sys.stdout = codecs.getwriter('utf8')(sys.stdout)
     sys.stderr = codecs.getwriter('utf8')(sys.stderr)
     print 'Debug email server is running. Now you can send emails to SMTP localhost:10250.'
Ejemplo n.º 45
0
	def __init__(self, localaddr, handler):
		SMTPServer.__init__(self, localaddr, None)
		self.handler = handler
Ejemplo n.º 46
0
    def __init__(self, localaddr, remoteaddr):
        SMTPServer.__init__(self, localaddr, remoteaddr)
        self.processor = RaindropEmailProcessor()

        self.hbase = RaindropHBaseClient()
Ejemplo n.º 47
0
 def __init__(self, *args, **kwargs):
     threading.Thread.__init__(self)
     SMTPServer.__init__(self, *args, **kwargs)
     self.active_lock = threading.Lock()
     self.active = False
     self.daemon = True
Ejemplo n.º 48
0
 def __init__(self, localaddr, remoteaddr, logger):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.log = logger
Ejemplo n.º 49
0
 def __init__(self, host, port):
     self.msgs = []
     SMTPServer.__init__(self, (host, port), None)
Ejemplo n.º 50
0
 def __init__(self, localaddr, handler):
     SMTPServer.__init__(self, localaddr, None)
     self.handler = handler
Ejemplo n.º 51
0
 def __init__(self, call_back_function=None):
     SMTPServer.__init__(self, ('localhost', 8025), (None, 0))
     self.call_back_function = call_back_function
Ejemplo n.º 52
0
 def __init__(self, localaddr, queue):
     SMTPServer.__init__(self, localaddr, None, decode_data=True)
     self.queue = queue
Ejemplo n.º 53
0
 def __init__(self, app, bindaddr, port):
     SMTPServer.__init__(self, (bindaddr, port), None)
     self.app = app
Ejemplo n.º 54
0
 def __init__(self, localaddr, remoteaddr, maildir):
     SMTPServer.__init__(self, localaddr, remoteaddr)
     self.maildir = maildir