示例#1
0
def latecomers_mail():
    # TODO: Change the emails to correct crossfitkalmar emails
    inactive_users = get_inactive_members()

    if inactive_users is not None:
        sender = cfg.sender
        recipients = cfg.recipients
        msg = MIMEMultipart("alternative")
        part1 = ""
        for user in inactive_users:
            temp_msg = user['user'].name + ' \r\n ' + \
                       user['user'].email + ' \r\n Telefon: ' + \
                       user['user'].phone + ' \r\n Adress: ' + \
                       user['user'].address + ' \r\n Taggade senast: ' + \
                       user['event'] + ' \r\n ' + \
                       str(user['days']) + ' dagar sedan senaste taggningen.'

            part1 = temp_msg + "\r\n\r\n" + part1

            # Converts string to UTF-8
            msg.attach(MIMEText(u'' + part1 + '', "plain", "utf-8"))

        msg.as_string().encode('ascii')

        msg['From'] = sender
        msg['To'] = ", ".join(recipients)
        msg['Subject'] = "Medlemmar som inte har taggat på 2 veckor!"
        s = smtplib.SMTP("smtp.crosstag.se", 587)
        # Hostname to send for this command defaults to the fully qualified domain name of the local host.
        s.ehlo()
        # Puts connection to SMTP server in TLS mode
        s.starttls()
        s.ehlo()
        s.login(sender, cfg.EMAIL_PASSWORD)
        s.sendmail(sender, recipients, msg.as_string())
        s.quit()
示例#2
0
def latecomers_mail():
    # TODO: Change the emails to correct crossfitkalmar emails
    inactive_users = get_inactive_members()

    if inactive_users is not None:
        sender = cfg.sender
        recipients = cfg.recipients
        msg = MIMEMultipart("alternative")
        part1 = ""
        for user in inactive_users:
            temp_msg = user['user'].name + ' \r\n ' + \
                       user['user'].email + ' \r\n Telefon: ' + \
                       user['user'].phone + ' \r\n Adress: ' + \
                       user['user'].address + ' \r\n Taggade senast: ' + \
                       user['event'] + ' \r\n ' + \
                       str(user['days']) + ' dagar sedan senaste taggningen.'

            part1 = temp_msg + "\r\n\r\n" + part1

            # Converts string to UTF-8
            msg.attach(MIMEText(u'' + part1 + '', "plain", "utf-8"))

        msg.as_string().encode('ascii')

        msg['From'] = sender
        msg['To'] = ", ".join(recipients)
        msg['Subject'] = "Medlemmar som inte har taggat på 2 veckor!"
        s = smtplib.SMTP("smtp.crosstag.se", 587)
        # Hostname to send for this command defaults to the fully qualified domain name of the local host.
        s.ehlo()
        # Puts connection to SMTP server in TLS mode
        s.starttls()
        s.ehlo()
        s.login(sender, cfg.EMAIL_PASSWORD)
        s.sendmail(sender, recipients, msg.as_string())
        s.quit()
示例#3
0
def inactive_check():
    return render_template('inactive_check.html',
                           title='Check',
                           hits=get_inactive_members())
示例#4
0
def inactive_check():
    return render_template('inactive_check.html',
                           title='Check',
                           hits=get_inactive_members())