def sendNotificationToMP(date): """ send a mail to the MP asking the question that the deadline of the question is aproaching """ status = u"Question pending response" #q_state.response_pending text = translate('notification_email_to_mp_question_pending_response', target_language='en', domain='bungeni.core', default="Questions pending responses.") session = Session() qfilter=sql.and_( (domain.Question.ministry_submit_date < date ), (domain.Question.status == status), ) questions = session.query(domain.Question).filter(qfilter).all() for question in questions: mailto = _getMemberOfParliamentEmail(question) if mailto and question.receive_notification: msg = MIMEText(text) msg['Subject'] = u'Questions pending response' msg['From'] = prefs.getAdministratorsEmail() msg['To'] = mailto text = text + '\n' + question.subject + '\n' print msg # !+SENDMAIL(ah,18-03-2010) #Mail sending is commented out below dispatch(msg)
def sendNotificationToClerksOffice(date): """ send a mail to the clerks office with stating all questions per ministry that are approaching the deadline """ text = translate('notification_email_to_clerk_question_pending_response', target_language='en', domain='bungeni.core', default="Questions pending responses.") ministries = _getAllMinistries(date) for ministry in ministries: questions = _getQuestionsPendingResponse(date, ministry) if questions: text = text + '\n' + ministry.full_name +': \n' for question in questions: text = text + question.subject + '\n' msg = MIMEText(text) msg['Subject'] = u'Questions pending response' msg['From'] = prefs.getAdministratorsEmail() msg['To'] = prefs.getClerksOfficeEmail() print msg # !+SENDMAIL(ah,18-03-2010) #Mail sending is commented out below dispatch(msg)
def sendNotificationToMP(date): """ send a mail to the MP asking the question that the deadline of the question is aproaching """ status = u"Question pending response" #q_state.response_pending text = translate('notification_email_to_mp_question_pending_response', target_language='en', domain='bungeni.core', default="Questions pending responses.") session = Session() qfilter = sql.and_( (domain.Question.ministry_submit_date < date), (domain.Question.status == status), ) questions = session.query(domain.Question).filter(qfilter).all() for question in questions: mailto = _getMemberOfParliamentEmail(question) if mailto and True: #!+NOTIFICATION_SETTINGS = True msg = MIMEText(text) msg['Subject'] = u'Questions pending response' msg['From'] = prefs.getAdministratorsEmail() msg['To'] = mailto text = text + '\n' + question.subject + '\n' print msg # !+SENDMAIL(ah,18-03-2010) #Mail sending is commented out below dispatch(msg)
def sendNotificationToMP(date): """ send a mail to the MP asking the question that the deadline of the question is aproaching """ status = u"Question pending response" #q_state.response_pending text = translate('notification_email_to_mp_question_pending_response', target_language='en', domain='bungeni.core', default="Questions pending responses.") session = Session() qfilter = sql.and_( (domain.Question.c.ministry_submit_date < date), (domain.Question.c.status == status), ) questions = session.query(domain.Question).filter(qfilter).all() for question in questions: mailto = _getMemberOfParliamentEmail(question) if mailto and question.receive_notification: msg = MIMEText(text) msg['Subject'] = u'Questions pending response' msg['From'] = prefs.getAdministratorsEmail() msg['To'] = mailto text = text + '\n' + question.subject + '\n' print msg
def sendNotificationToClerksOffice(date): """ send a mail to the clerks office with stating all questions per ministry that are approaching the deadline """ text = translate('notification_email_to_clerk_question_pending_response', target_language='en', domain='bungeni.core', default="Questions pending responses.") ministries = _getAllMinistries(date) for ministry in ministries: questions = _getQuestionsPendingResponse(date, ministry) if questions: text = text + '\n' + ministry.full_name + ': \n' for question in questions: text = text + question.subject + '\n' msg = MIMEText(text) msg['Subject'] = u'Questions pending response' msg['From'] = prefs.getAdministratorsEmail() msg['To'] = prefs.getClerksOfficeEmail() print msg # !+SENDMAIL(ah,18-03-2010) #Mail sending is commented out below dispatch(msg)