Example #1
0
 def _createMessage(self, subject):
   msg = MIMEMultipart()
   msg['Subject'] = subject
   msg['From'] = self.user
   msg['To'] = ",".join(self.recipients)
   msg.preample = 'Your mail attacment follows'
   return msg;
def buildMessage(options):
    msg = MIMEMultipart()    
    msg['Subject'] = 'Mail including attachment'
    msg['From'] = options.user
    msg['To'] = options.recipients
    msg.preample = 'Your mail attacment follows'
    return msg;
Example #3
0
 def _createMessage(self, subject):
     msg = MIMEMultipart()
     msg['Subject'] = subject
     msg['From'] = self.user
     msg['To'] = ",".join(self.recipients)
     msg.preample = 'Your mail attacment follows'
     return msg
Example #4
0
def collect(base, from_addr, to_addr):
    """Collect xml reports and create MIME message."""
    msg = MIMEMultipart()
    msg['Subject'] = 'ucs-test'
    msg['From'] = from_addr
    msg['To'] = to_addr
    msg.preample = 'ucs-test results'

    for dirpath, dirnames, filenames in os.walk(base):
        for file_name in filenames:
            if not file_name.endswith('.xml'):
                continue
            path_name = os.path.join(dirpath, file_name)
            attach(msg, path_name)
        for dir_name in dirnames:
            if dir_name.startswith('.'):
                dirnames.remove(dir_name)
    return msg