def mail_user_story_create(host, subject, users): context = { 'current_host': host, } param = {'subject': subject} for user in users: params.update({'to': [user.email]}) mail.send("user.story.created", context, **params)
def mail_question_assigned(host, subject, question, user): context = { 'user': user, 'current_host': host, 'question': question, } params = { 'to': [user.email], 'subject': subject, } return mail.send("question.assigned", context, **params)
def mail_new_registration(host, subject, user): context = { 'user': user, 'token': set_token(user), 'current_host': host, } params = { 'to': [user.email], 'subject': subject, } return mail.send("new.registration", context, **params)
def mail_question_created(host, subject, question, project): participants = set(project.participants.all()) context = { 'question': question, 'current_host': host, 'project': project, } params = { 'to': [x.email for x in participants], 'subject': subject, } return mail.send("question.created", context, **params)
def mail_recovery_password(host, subject, user): """ Set token for user profile and send password recovery mail. """ context = { 'user': user, 'token': set_token(user), 'current_host': host, } params = { 'to': [user.email], 'subject': subject, } return mail.send("password.recovery", context, **params)