Beispiel #1
0
def project_invite(project, email, is_registered=True):
    quoted_email = quote_plus(email)

    html = _render_email(
        "project_invite.html",
        base_url=BASE_URL,
        project=project,
        meta=meta,
        email=quoted_email,
        is_registered=is_registered,
    )

    text = _render_email(
        "project_invite.txt",
        base_url=BASE_URL,
        project=project,
        meta=meta,
        email=quoted_email,
        is_registered=is_registered,
    )

    subject = _render_email("project_invite.sub.txt", project=project, meta=meta)

    mailer = Mailer(**MAILER_PARAMS)
    mailer.send(from_addr=MAIL_FROM, to_addr=email, subject=subject, text=text, html=html)
Beispiel #2
0
def _send_email(template_prefix, recipients, **kwargs):
    kwargs["meta"] = meta

    text = _render_email("%s.txt" % template_prefix, **kwargs)
    subject = _render_email("%s.sub.txt" % template_prefix, **kwargs)
    html = _render_email("%s.html" % template_prefix, **kwargs)
    mailer = Mailer(**MAILER_PARAMS)
    mailer.send(from_addr=MAIL_FROM, to_addr=recipients, subject=subject, text=text, html=html)
Beispiel #3
0
def send_welcome_email(luser):
    text = _render_email("welcome.txt", luser=luser, meta=meta)
    html = _render_email("welcome.html", luser=luser, meta=meta)
    subject = _render_email("welcome.sub.txt", luser=luser, meta=meta)
    mailer = Mailer(**MAILER_PARAMS)
    mailer.send(from_addr=MAIL_FROM, to_addr=luser.email, subject=subject, text=text)
Beispiel #4
0
def forgot_password(email, link):
    text = _render_email("forgot_password.txt", link=link, meta=meta)
    html = _render_email("forgot_password.html", link=link, meta=meta)
    mailer = Mailer(**MAILER_PARAMS)
    mailer.send(from_addr=MAIL_FROM, to_addr=email, subject="CodeColab password recovery.", text=text)
Beispiel #5
0
def member_report(project, report, subject):
    recipients = project.recipients()
    html = _render_email("report.html", report=report, meta=meta)
    text = _render_email("report.txt", report=report, meta=meta)
    mailer = Mailer(**MAILER_PARAMS)
    mailer.send(from_addr=MAIL_FROM, to_addr=recipients, subject=subject, html=html, text=text)
                # Print out today's users who have hours, as an aid.
                print "%s\t%s\t%s" % (luser.profile[0].username,
                                      range.start_time,
                                      range.end_time)

                
                # Only notify within the first 15 minutes of the hour after.
                # This will allow us to use the flow of time to avoid 
                # duplicating notifications.
                time_now = now.time()
               

                end_time_in_minutes = range.end_time.hour * 60 + range.end_time.minute
                now_in_minutes = time_now.hour * 60 + time_now.minute

                # If it is within 15 minutes after an hour has passed,
                # send the reminder email
                if end_time_in_minutes + 60 < now_in_minutes and \
                    now_in_minutes < end_time_in_minutes + 75:

                    # send the email.
                    mailer.send(from_addr=MAIL_FROM, to_addr=luser.email,
                                subject="Reminder: Please report in on %s" % \
                                schedule.project.name,
                                text=message % \
                                { "username" : luser.profile[0].username,
                                  "project" : schedule.project.name,
                                  "url" : BASE_URL })
                else:
                    print "no mail sent."