def send(self, window, addr): if not self.processor: window.show_warning(_('The email plugin is enabled but not configured. Please go to its settings and configure it, or disable it if you do not wish to use it.')) return from electroncash import paymentrequest r = window.wallet.receive_requests.get(addr) message = r.get('memo', '') if r.get('signature'): pr = paymentrequest.serialize_request(r) else: pr = paymentrequest.make_request(self.config, r) if not pr: return recipient, ok = QInputDialog.getText(window, _('Send request'), _('Email invoice to:')) if not ok: return recipient = str(recipient) payload = pr.SerializeToString() self.print_error('sending mail to', recipient) try: self.processor.send(recipient, message, payload) except Exception as e: self.print_error("Exception sending:", repr(e)) # NB; we don't want to actually display the exception message here # because it may contain text from the server, which could be a # potential phishing attack surface. So instead we show the user # the exception name which is something like ConnectionRefusedError. window.show_error(_("Could not send email to {recipient}: {reason}").format(recipient=recipient, reason=type(e).__name__)) return window.show_message(_('Request sent.'))
def send(self, window, addr): from electroncash import paymentrequest r = window.wallet.receive_requests.get(addr) message = r.get('memo', '') if r.get('signature'): pr = paymentrequest.serialize_request(r) else: pr = paymentrequest.make_request(self.config, r) if not pr: return recipient, ok = QInputDialog.getText(window, _('Send request'), _('Email invoice to:')) if not ok: return recipient = str(recipient) payload = pr.SerializeToString() self.print_error('sending mail to', recipient) try: self.processor.send(recipient, message, payload) except Exception as e: self.print_error("Exception sending:", repr(e)) window.show_error( _("Could not send email to {recipient}").format( recipient=recipient)) return window.show_message(_('Request sent.'))