def fillresponse(self): legal = LegalEntity.objects.get(id=1) if self.getparam('CONFIRME') is None: dlg = self.create_custom() img = XferCompImage('img') img.set_value(self.icon_path()) img.set_location(0, 0, 1, 3) dlg.add_component(img) lbl = XferCompLabelForm('lbl_title') lbl.set_location(1, 0, 2) lbl.set_value_as_header(self.caption) dlg.add_component(lbl) email = XferCompEdit('recipient') email.set_location(1, 1) email.set_value(legal.email) email.mask = r"[^@]+@[^@]+\.[^@]+" email.description = _("email") dlg.add_component(email) dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'CONFIRME': 'YES'}) dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png')) else: abs_url = self.request.META.get( 'HTTP_REFERER', self.request.build_absolute_uri()).split('/') self.item.http_root_address = '/'.join(abs_url[:-2]) send_email([self.getparam('recipient')], self.item.subject, self.item.email_content, files=self.item.attach_files) self.message(_("EMail send, check it."))
def fillresponse(self): if not will_mail_send(): raise LucteriosException(IMPORTANT, _('Bad email parameter!')) legal = LegalEntity.objects.get(id=1) if self.getparam('CONFIRME') is None: dlg = self.create_custom() img = XferCompImage('img') img.set_value(self.icon_path()) img.set_location(0, 0, 1, 3) dlg.add_component(img) lbl = XferCompLabelForm('lbl_title') lbl.set_location(1, 0, 2) lbl.set_value_as_header(self.caption) dlg.add_component(lbl) email = XferCompEdit('recipient') email.set_location(1, 1) email.set_value(legal.email) email.mask = r"[^@]+@[^@]+\.[^@]+" email.description = _("email") dlg.add_component(email) dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'CONFIRME': 'YES'}) dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png')) else: address = [] address.append("") address.append("") address.append(six.text_type(legal)) address.append(legal.address) address.append("%s %s" % (legal.postal_code, legal.city)) message = _('EMail sent to check configuration') message += "{[br/]}".join(address).replace('{[newline]}', "{[br/]}").replace("\n", '{[br/]}') bad_sended = send_email(self.getparam('recipient'), _("EMail try"), "<html><body>%s</body></html>" % message.replace('{[', '<').replace(']}', '>')) if len(bad_sended) != 0: raise EmailException(bad_sended) self.message(_("EMail send, check it."))
def fillresponse(self): img = XferCompImage('img') img.set_value(self.icon_path()) img.set_location(0, 0, 1, 3) self.add_component(img) lbl = XferCompLabelForm('lbl_title') lbl.set_location(1, 0, 2) lbl.set_value_as_header(_("To receive by email your login and a new password.")) self.add_component(lbl) email = XferCompEdit('email') email.set_location(1, 1) email.mask = r"[^@]+@[^@]+\.[^@]+" email.description = _("email") self.add_component(email) self.add_action(AskPasswordAct.get_action(_('Ok'), 'images/ok.png')) self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))