'Create a message and send it'

def process_email(self):

    try:
        msg = MIMEMultipart('alternative')
        msg['From'] = self.fromaddr
        msg['To'] = self.toaddr
        msg['Subject'] = self.subject
        text = self.body
        html = self.html
        if self.signature:
            text += self.signature
        part1 = MIMEText(text.encode('utf-8'), 'plain', 'utf-8')
        msg.attach(part1)
        if html:
            part2 = MIMEText(html.encode('utf-8'), 'html', 'utf-8')
            msg.attach(part2)
        if (not self.port):
            (self.port, self.ssl) = self.get_smtp_port(self.server)
        if (self.ssl and hasattr(smtplib, 'SMTP_SSL')):
            s = smtplib.SMTP_SSL(self.server, self.port)
        else:
            s = smtplib.SMTP(self.server, self.port)
        s.set_debuglevel(0)
        s.ehlo()
        try:
            s.starttls()
        except smtplib.SMTPException:
            pass
        s.ehlo()
        if (self.username is not None):
            s.login(self.username, self.password)
        s.sendmail(self.fromaddr, self.toaddr, msg.as_string())
        s.close()
        return True
    except:
        if settings.DEBUG:
            raise
        else:
            import traceback
            import sys
            from treeio import core
            from django.core.mail import mail_admins
            (exc_type, exc_value, exc_traceback) = sys.exc_info()
            domain = getattr(settings, 'CURRENT_DOMAIN', 'default')
            subject = ('Exception    for    %s:    %s    %s' % (domain, unicode(exc_type), unicode(exc_value)))
            body = (subject + '\n\n')
            body += (unicode(core.__file__) + '\n\n')
            body += (u'Server:    %s\n\n' % self.server)
            body += (u'Port:    %s\n\n' % unicode(self.port))
            body += (u'Username:    %s\n\n' % self.username)
            body += (u'From:    %s\n\n' % self.fromaddr)
            body += (u'To:    %s\n\n' % self.toaddr)
            for s in traceback.format_tb(exc_traceback):
                body += (s + '\n')
            mail_admins(subject, body)
