Example #1
0
    def send_confirmation_email(self):
        """An email confirming that the order has been confirmed and that we
        are waiting for the payment confirmation if we are really waiting for
        it.

        For setting a convention this email has to be sent by rendering the
        templates

           * Text: `emails/sale-confirmation-text.jinja`
           * HTML: `emails/sale-confirmation-html.jinja`

        """
        email_message = render_email(
            CONFIG['smtp_from'], self.invoice_address.email,
            'Order Completed',
            text_template = 'emails/sale-confirmation-text.jinja',
            html_template = 'emails/sale-confirmation-html.jinja',
            sale = self
        )
        server = get_smtp_server()
        server.sendmail(
            CONFIG['smtp_from'], [self.invoice_address.email],
            email_message.as_string()
        )
        server.quit()
Example #2
0
    def send_confirmation_email(self, silent=True):
        """An email confirming that the order has been confirmed and that we
        are waiting for the payment confirmation if we are really waiting for
        it.

        For setting a convention this email has to be sent by rendering the
        templates

           * Text: `emails/sale-confirmation-text.jinja`
           * HTML: `emails/sale-confirmation-html.jinja`

        """
        try:
            email_message = render_email(
                CONFIG['smtp_from'], self.party.email, 'Order Completed',
                text_template='emails/sale-confirmation-text.jinja',
                html_template='emails/sale-confirmation-html.jinja',
                sale=self
            )
            server = get_smtp_server()
            server.sendmail(
                CONFIG['smtp_from'], [self.party.email],
                email_message.as_string()
            )
            server.quit()
        except Exception, exc:
            if not silent:
                raise
            current_app.logger.error(exc)
Example #3
0
    def send_magic_login_link(cls, email):
        """
        Send a magic login email to the user
        """
        EmailQueue = Pool().get('email.queue')

        try:
            nereid_user, = cls.search([
                ('email', '=', email.lower()),
                ('company', '=', current_website.company.id),
            ])
        except ValueError:
            # This email was not found so, let user know about this
            message = "No user with email %s was found!" % email
            current_app.logger.debug(message)
        else:
            message = "Please check your mail and follow the link"
            email_message = render_email(
                config.get('email', 'from'),
                email,
                _('Magic Signin Link'),
                text_template='emails/magic-login-text.jinja',
                html_template='emails/magic-login-html.jinja',
                nereid_user=nereid_user)
            EmailQueue.queue_mail(config.get('email', 'from'), email,
                                  email_message.as_string())

        return cls.build_response(message,
                                  redirect(url_for('nereid.website.home')),
                                  200)
Example #4
0
    def send_magic_login_link(cls, email):
        """
        Send a magic login email to the user
        """
        EmailQueue = Pool().get("email.queue")

        try:
            nereid_user, = cls.search([("email", "=", email.lower()), ("company", "=", current_website.company.id)])
        except ValueError:
            # This email was not found so, let user know about this
            message = "No user with email %s was found!" % email
            current_app.logger.debug(message)
        else:
            message = "Please check your mail and follow the link"
            email_message = render_email(
                config.get("email", "from"),
                email,
                _("Magic Signin Link"),
                text_template="emails/magic-login-text.jinja",
                html_template="emails/magic-login-html.jinja",
                nereid_user=nereid_user,
            )
            EmailQueue.queue_mail(config.get("email", "from"), email, email_message.as_string())

        return cls.build_response(message, redirect(url_for("nereid.website.home")), 200)
Example #5
0
    def send_reset_email(self):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        EmailQueue = Pool().get('email.queue')

        email_message = render_email(config.get('email', 'from'),
                                     self.email,
                                     _('Account Password Reset'),
                                     text_template='emails/reset-text.jinja',
                                     html_template='emails/reset-html.jinja',
                                     nereid_user=self)
        EmailQueue.queue_mail(config.get('email', 'from'), self.email,
                              email_message.as_string())
Example #6
0
    def send_reset_email(self):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        email_message = render_email(CONFIG['smtp_from'],
                                     self.email,
                                     _('Account Password Reset'),
                                     text_template='emails/reset-text.jinja',
                                     html_template='emails/reset-html.jinja',
                                     nereid_user=self)
        server = get_smtp_server()
        server.sendmail(CONFIG['smtp_from'], [self.email],
                        email_message.as_string())
        server.quit()
Example #7
0
    def send_reset_email(self):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        EmailQueue = Pool().get('email.queue')

        email_message = render_email(
            CONFIG['smtp_from'], self.email, _('Account Password Reset'),
            text_template='emails/reset-text.jinja',
            html_template='emails/reset-html.jinja',
            nereid_user=self
        )
        EmailQueue.queue_mail(
            CONFIG['smtp_from'], self.email, email_message.as_string()
        )
Example #8
0
    def send_reset_email(self, nereid_user):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        email_message = render_email(
            CONFIG["smtp_from"],
            nereid_user.email,
            _("Account Password Reset"),
            text_template="emails/reset-text.jinja",
            html_template="emails/reset-html.jinja",
            nereid_user=nereid_user,
        )
        server = get_smtp_server()
        server.sendmail(CONFIG["smtp_from"], [nereid_user.email], email_message.as_string())
        server.quit()
Example #9
0
    def send_activation_email(self, nereid_user):
        """
        Send an activation email to the user

        :param nereid_user: The browse record of the user
        """
        email_message = render_email(
            CONFIG['smtp_from'], nereid_user.email, _('Account Activation'),
            text_template = 'emails/activation-text.jinja',
            html_template = 'emails/activation-html.jinja',
            nereid_user = nereid_user
        )
        server = get_smtp_server()
        server.sendmail(
            CONFIG['smtp_from'], [nereid_user.email], email_message.as_string()
        )
        server.quit()
Example #10
0
    def send_reset_email(self):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        email_message = render_email(
            CONFIG['smtp_from'], self.email, _('Account Password Reset'),
            text_template='emails/reset-text.jinja',
            html_template='emails/reset-html.jinja',
            nereid_user=self
        )
        server = get_smtp_server()
        server.sendmail(
            CONFIG['smtp_from'], [self.email], email_message.as_string()
        )
        server.quit()
Example #11
0
    def send_reset_email(self):
        """
        Send an account reset email to the user

        :param nereid_user: The browse record of the user
        """
        EmailQueue = Pool().get("email.queue")

        email_message = render_email(
            config.get("email", "from"),
            self.email,
            _("Account Password Reset"),
            text_template="emails/reset-text.jinja",
            html_template="emails/reset-html.jinja",
            nereid_user=self,
        )
        EmailQueue.queue_mail(config.get("email", "from"), self.email, email_message.as_string())
Example #12
0
File: user.py Project: 2cadz/nereid
    def send_activation_email(self):
        """
        Send an activation email to the user

        :param nereid_user: The browse record of the user
        """
        EmailQueue = Pool().get('email.queue')

        email_message = render_email(
            config.get('email', 'from'),
            self.email, _('Account Activation'),
            text_template='emails/activation-text.jinja',
            html_template='emails/activation-html.jinja',
            nereid_user=self
        )
        EmailQueue.queue_mail(
            config.get('email', 'from'), self.email, email_message.as_string()
        )