def send_activation_email(self,new_user,password,registration_profile,air_id='',domain_override='',prefix='',reason='',data={},error_symbol=None): from vyperlogix.products import keys _current_site_ = domain_override if (domain_override and len(domain_override) > 0) else settings.CURRENT_SITE _current_site = '.'.join([t.capitalize() for t in _current_site_.split('.')]) subject = django_utils.render_from_string(__registration_activation_email_subject__,context=Context({ 'site': _current_site },autoescape=False)) subject = ''.join(subject.splitlines()) # Email subject *must not* contain newlines c = { 'activation_key': keys.encode('%s;%s;%s'%(registration_profile.user.email,password,registration_profile.activation_key)), 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'site': _current_site if (settings.IS_PRODUCTION_WEB_SERVER) else settings.LOCALHOST, 'site_name': _current_site, 'ssl':'s' if (settings.IS_PRODUCTION_SERVER) else '', } c['activation_symbol'] = '%sactivation/' % ('' if _current_site.endswith('/') else '/') message = django_utils.render_from_string(__registration_activation_email__,context=c) message_html = django_utils.render_from_string(__registration_activation_email_html__,context=c) try: logging.log(logging.INFO,'sender="%s Support <%s>"' % (air_sender(air_id),air_sender(air_id))) queue_email(air_sender(air_id),new_user.email,"Your User Account %sActivation%s for %s" % (prefix,' (%s)'%(reason) if (reason and misc.isString(reason) and (len(reason) > 0)) else '',air_site(air_id)),message,message_html,air_id,is_html=True,data=data,error_symbol=error_symbol) except Exception, e: info_string = _utils.formattedException(details=e) logging.error('RegistrationManager.create_inactive_user.ERROR --> %s' % (info_string))
def send_problem_email(self,fromName,email,msg,air_id='',domain_override=''): _current_site_ = domain_override if (domain_override and len(domain_override) > 0) else settings.CURRENT_SITE _current_site = _current_site_.replace('.appspot','').replace('.com','').capitalize() subject = django_utils.render_from_string(__registration_problem_email_subject__,context=Context({ 'fromName': fromName, 'site': _current_site },autoescape=False)) subject = ''.join(subject.splitlines()) # Email subject *must not* contain newlines c = { 'msg': msg, 'fromName': fromName, 'site': _current_site_, 'site_name': _current_site } message = django_utils.render_from_string(__problem_report_email__,context=c) message_html = django_utils.render_from_string(__problem_report_email_html__,context=c) try: queue_email(email,air_sender(air_id),subject,message,message_html,air_id,is_html=True) except Exception, e: info_string = _utils.formattedException(details=e) logging.error('RegistrationManager.create_inactive_user.ERROR --> %s' % (info_string))
def send_passwordChg_email(self,user,old_password,password,air_id='',domain_override=''): _current_site_ = domain_override if (domain_override and len(domain_override) > 0) else settings.CURRENT_SITE _current_site = _current_site_.replace('.appspot','').replace('.com','').capitalize() subject = django_utils.render_from_string(__registration_activation_email_subject__,context=Context({ 'site': _current_site },autoescape=False)) subject = ''.join(subject.splitlines()) # Email subject *must not* contain newlines c = { 'key': user.id, 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'site': _current_site_, 'site_name': _current_site, 'ssl':'s' if (settings.IS_PRODUCTION_SERVER) else '', 'air_id':air_id, 'old_password':old_password, 'password':password, } message = django_utils.render_from_string(__password_change_email__,context=c) message_html = django_utils.render_from_string(__password_change_email_html__,context=c) try: queue_email(air_sender(air_id),user.email,"Password Change Request for %s" % (air_site(air_id)),message,message_html,air_id,is_html=True) except Exception, e: info_string = _utils.formattedException(details=e) logging.error('RegistrationManager.changePassword.ERROR --> %s' % (info_string))