Пример #1
0
def send_generic_mail(to_address, subject, body, mail_from=None):

    if mail_from:
        email_from = mail_from
    else:
        email_from = mailer_settings['from_address']

    send_mailx(text_content=body,
               html_content=body,
               subject=subject,
               to_=to_address,
               email_from_=email_from,
               mail_host=mailer_settings['host'],
               mail_port=mailer_settings['port'])
def __send_notification_email(email, subject, html_content, text_content=''):

    if not text_content:
        text_content = 'text content'

    email_content = 'email content'
    mail_from = '*****@*****.**'

    send_mailx(text_content=email_content,
               html_content=html_content,
               subject=subject,
               to_=email,
               email_from_='*****@*****.**',
               mail_host=mailer_host,
               mail_port=mailer_port)
Пример #3
0
def __send_email( to_, text_content, html_content, subject  ):


    email_from_= email_sending_config['mail_from_address']
    mail_host=email_sending_config['host']
    mail_port=email_sending_config['port']


    send_mailx( text_content=text_content, 
            html_content=html_content, 
            subject=subject, 
            to_=to_, 
            email_from_=email_from_, 
            mail_host=mail_host, 
            mail_port=mail_port )
Пример #4
0
    def send_confirmation_email(self, to_address, free_details, paid30_details,
                                paid14_details):
        '''
            @description:
                -
        '''
        subject = '[Chikka SMS API] Email successfully sent confirmation'
        body = 'Please see details below'

        body += '<br/><br/>FREE accounts (7 days before expiration)<br/>'
        body += str(free_details)

        body += '<br/><br/>PAID accounts (30 before expiration)<br/>'
        body += str(paid30_details)

        body += '<br/><br/>PAID accounts (14 before expiration)<br/>'
        body += str(paid14_details)

        return send_mailx(text_content=body,
                          html_content=body,
                          subject=subject,
                          to_=to_address,
                          email_from_=self.mailer_settings['from_address'],
                          mail_host=self.mailer_settings['host'],
                          mail_port=self.mailer_settings['port'])
Пример #5
0
    def send_email(self, to_address, shortcode, days_before_expiration):
        '''
            @description:
                - sends an information email
                to users with expiring short code
        '''

        body = EMAIL_SPIEL

        if str(days_before_expiration) == 'Thirty':
            body = body % (days_before_expiration, '30', 'replenish', '.')
        elif str(days_before_expiration) == 'Fourteen':
            body = body % (days_before_expiration, '14', 'replenish', '.')
        elif str(days_before_expiration) == 'Seven':
            body = body % (days_before_expiration, '7', 'upgrade',
                           ' and keep your short code.')

        subject = 'Reminder about your Chikka API short code'

        return send_mailx(text_content=body,
                          html_content=body,
                          subject=subject,
                          to_=to_address,
                          email_from_=self.mailer_settings['from_address'],
                          mail_host=self.mailer_settings['host'],
                          mail_port=self.mailer_settings['port'])
                    elif verifi_type == 'PASSWORD':
                        email_content = verification_object.generate_forget_password_content(
                        )

                html_content = email_content.replace("\n", '<br>')

                #--- mailer configs
                mail_from = values['mailer']['mail_from_address']
                mailer_host = values['mailer']['host']
                mailer_port = values['mailer']['port']
                l.info('sending email', email)

                send_mailx(text_content=email_content,
                           html_content=html_content,
                           subject=subject,
                           to_=email,
                           email_from_=mail_from,
                           mail_host=mailer_host,
                           mail_port=mailer_port)

                # after sending, delete email content cache

                content_cache_key = 'emailcontent:%s' % verifi_id
                l.debug('deleting email content cache',
                        {'key': content_cache_key})
                redisconn.delete(content_cache_key)

                # step 2 if no complaint, update verification, set send_status to 'SENT'
                l.info('email sent')
                Verification.set_send_status_sent(verification_id=verifi_id)