예제 #1
0
 def sendMail(self):
     link = self.webRTCaddress()
     topic = "nao_robot/camera/top/camera/image_raw"
     text = "please see the video from this address " + link
     text = text + " with topic name " + topic
     mail = Mail(text)
     mail.sendMail()
예제 #2
0
 def sendMail(self):
     #link = self.webRTCaddress()
     topic = "nao_robot/camera/top/camera/image_raw"
     text = "The assistance robot and smart house has detected a fall. To check, please see the video from this address "  #+ link
     text = text + "/stream_viewer?topic=" + topic
     mail = Mail(text)
     mail.sendMail()
    def sendReports(self, option):
        """ Send out reports via email """

        msg = {}        # mail header and body
        mail = ''
        server = {}     # smtp server
        m = Mail()

        # smtp server address and tcp port
        server['addr'] = self.opts['smtp_host']
        server['port'] = self.opts['smtp_port']

        # smtp (static content) read from ini file
        msg['from'] = self.opts['smtp_from']

        Wrapper.msg('Sending out reports')

        if option == 'report':
            # for each report in report directory except summary.txt
            for f in os.listdir(self.opts['outdir'] + '/' + TODAY):
                if f != 'summary.txt':
                    report = self.opts['outdir'] + '/' + TODAY + '/' + f
                    name = f.split('.')[0]

                    # mail header + body
                    msg['message'] = 'Hi,\n\nplease find attached the Nessus ' \
                            'report for this week.\n\nBest Regards,\n\n' \
                            "Rocket Internet's Security Team"
                    msg['subject'] = '[{0}] Your new Nessus report for {1} ' \
                            'is ready'.format(name, TODAY)
                    msg['to'] = self.ini.config.get('addressbook', name)

                    # build and send mail
                    mail = m.buildMail(msg, (report,))
                    m.sendMail(server, mail, self.opts['smtp_login'], tls=True)
        else:
            report = self.opts['outdir'] + '/' + TODAY + '/' + 'summary.txt'
            with open(report, 'r') as f:
                report_data = f.read()

            # mail header + body
            msg['message'] = 'Hi,\n\nplease find below the Nessus ' \
                    'Summary Report for this week:\n\n'
            msg['message'] += report_data
            msg['message'] += "\n\nBest Regards,\n\nRocket Internet's " \
                    "Security Team"
            msg['subject'] = 'Nessus Summary Report ({0})'.format(TODAY)
            msg['to'] = self.ini.config.get('addressbook', 'Summary')

            # build and send mail
            mail = m.buildMail(msg, (report,))
            m.sendMail(server, mail, self.opts['smtp_login'], tls=True)

        return
예제 #4
0
 def emit(self, record):
     """
     # @Synopsis  override logging.Handler emit method, the action when receive
     # the logging record
     #
     # @Args record
     #
     # @Returns nothing
     """
     msg = self.format(record)
     Mail.sendMail(EnvConfig.MAIL_RECEIVERS, 'PROGRAM ALARM', msg)
    def sendReports(self, option):
        """ Send out reports via email """

        msg = {}  # mail header and body
        mail = ''
        server = {}  # smtp server
        m = Mail()

        # smtp server address and tcp port
        server['addr'] = self.opts['smtp_host']
        server['port'] = self.opts['smtp_port']

        # smtp (static content) read from ini file
        msg['from'] = self.opts['smtp_from']

        Wrapper.msg('Sending out reports')

        if option == 'report':
            # for each report in report directory except summary.txt
            for f in os.listdir(self.opts['outdir'] + '/' + TODAY):
                if f != 'summary.txt':
                    report = self.opts['outdir'] + '/' + TODAY + '/' + f
                    name = f.split('.')[0]

                    # mail header + body
                    msg['message'] = 'Hi,\n\nplease find attached the Nessus ' \
                            'report for this week.\n\nBest Regards,\n\n' \
                            "Rocket Internet's Security Team"
                    msg['subject'] = '[{0}] Your new Nessus report for {1} ' \
                            'is ready'.format(name, TODAY)
                    msg['to'] = self.ini.config.get('addressbook', name)

                    # build and send mail
                    mail = m.buildMail(msg, (report, ))
                    m.sendMail(server, mail, self.opts['smtp_login'], tls=True)
        else:
            report = self.opts['outdir'] + '/' + TODAY + '/' + 'summary.txt'
            with open(report, 'r') as f:
                report_data = f.read()

            # mail header + body
            msg['message'] = 'Hi,\n\nplease find below the Nessus ' \
                    'Summary Report for this week:\n\n'
            msg['message'] += report_data
            msg['message'] += "\n\nBest Regards,\n\nRocket Internet's " \
                    "Security Team"
            msg['subject'] = 'Nessus Summary Report ({0})'.format(TODAY)
            msg['to'] = self.ini.config.get('addressbook', 'Summary')

            # build and send mail
            mail = m.buildMail(msg, (report, ))
            m.sendMail(server, mail, self.opts['smtp_login'], tls=True)

        return
예제 #6
0
파일: main.py 프로젝트: adrien914/Mail_Api
def main():
    mail = Mail("*****@*****.**", "Ayomi75010@")
    mail.sendMail("*****@*****.**", "Hello",
                  "Is it me your looking for ?")
    mail.closeConnection()