Ejemplo n.º 1
0
Archivo: smtp.py Proyecto: ambasta/zato
    def handle(self):

        with closing(self.odb.session()) as session:
            item = session.query(SMTP).filter_by(id=self.request.input.id).one()

        msg = SMTPMessage()
        msg.from_ = item.ping_address
        msg.to = item.ping_address
        msg.subject = 'Zato SMTP ping (Α Β Γ Δ Ε Ζ Η)'.encode('utf-8')
        msg.body = 'Hello from {}\nUTF-8 test: Α Β Γ Δ Ε Ζ Η'.encode('utf-8').format(version)
        msg.headers['Charset'] = 'utf-8'

        msg.attach('utf-8.txt', 'Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω'.encode('utf-8'))
        msg.attach('ascii.txt', 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z')

        start_time = time()
        self.email.smtp.get(item.name, True).conn.send(msg)
        response_time = time() - start_time

        self.response.payload.info = 'Ping submitted, took:`{0:03.4f} s`, check server logs for details.'.format(response_time)
Ejemplo n.º 2
0
    def handle(self):

        default_e_mail = self.request.payload['default_e_mail']
        e_posta =self.request.payload['e_posta']
        message = self.request.payload['message']
        subject = self.request.payload['subject']

        # Obtain a connection
        conn = self.email.smtp.get('Ulakbus-Mail').conn

        # Create a regular e-mail
        msg = SMTPMessage()
        msg.subject = subject
        msg.to = e_posta
        msg.from_ = default_e_mail
        msg.body = message

        # Send the message
        conn.send(msg)

        self.response.status_code = httplib.OK
        self.response.payload = {'status': 'ok', 'result': 'Success'}
    def send_mail(self, outgoing_name, timestamp):
        self.logger.info('Send mail executing')
        conn = self.email.smtp.get('GMAIL').conn

        msg = SMTPMessage()
        msg.subject = 'Conexión Saliente ' + str(outgoing_name) + ' caida'
        msg.to = '*****@*****.**'
        msg.from_ = '*****@*****.**'
        msg.body = 'La conexión saliente ' + str(
            outgoing_name) + ' está caida a fecha de ' + str(timestamp)
        conn.send(msg)
Ejemplo n.º 4
0
    def handle(self):

        # Obtain a connection
        conn = self.email.smtp.get('GMAIL').conn

        # Create a regular e-mail
        msg = SMTPMessage()
        msg.subject = 'Hello'
        msg.to = '*****@*****.**'
        msg.from_ = '*****@*****.**'
        msg.body = 'El servicio Add se ha quedado moñeco!! Salu2 :D'

        # Send the message
        conn.send(msg)
Ejemplo n.º 5
0
    def handle(self):

        default_e_mail = self.request.payload['default_e_mail']
        e_posta =self.request.payload['e_posta']
        message = self.request.payload['message']
        subject = self.request.payload['subject']

        # Obtain a connection
        conn = self.email.smtp.get('Ulakbus-Mail').conn

        # Create a regular e-mail
        msg = SMTPMessage()
        msg.subject = subject
        msg.to = e_posta
        msg.from_ = default_e_mail
        msg.body = message

        # Send the message
        conn.send(msg)

        self.response.status_code = httplib.OK
        self.response.payload = {'status': 'ok', 'result': 'Success'}
Ejemplo n.º 6
0
    def handle(self):

        with closing(self.odb.session()) as session:
            item = session.query(SMTP).filter_by(id=self.request.input.id).one()

        msg = SMTPMessage()
        msg.from_ = item.ping_address
        msg.to = item.ping_address
        msg.cc = item.ping_address
        msg.bcc = item.ping_address
        msg.subject = 'Zato SMTP ping (Α Β Γ Δ Ε Ζ Η)'
        msg.headers['Charset'] = 'utf-8'

        msg.body = 'Hello from {}\nUTF-8 test: Α Β Γ Δ Ε Ζ Η'.format(version).encode('utf-8')

        msg.attach('utf-8.txt', 'Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω'.encode('utf-8'))
        msg.attach('ascii.txt', 'A B C D E F G H I J K L M N O P Q R S T U V W X Y Z')

        start_time = time()
        self.email.smtp.get(item.name, True).conn.send(msg)
        response_time = time() - start_time

        self.response.payload.info = 'Ping submitted, took:`{0:03.4f} s`, check server logs for details.'.format(response_time)