django.core.mail.send_mail

Here are the examples of the python api django.core.mail.send_mail taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

175 Examples 7

Example 1

Project: ecobasa Source File: mail_patch_postman.py
def email(subject_template, message_template, recipient_list, object):
    """Compose and send an email."""
    ctx_dict = {'site': Site.objects.get_current(), 'object': object, 'action': 'acceptance'}
    subject = render_to_string(subject_template, ctx_dict)
    # Email subject *must not* contain newlines
    subject = ''.join(subject.splitlines())
    message = render_to_string(message_template, ctx_dict)
    # during the development phase, consider using the setting: EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
    send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list, fail_silently=True)

Example 2

Project: timtec Source File: forms.py
Function: send_email
    def send_email(self):
        subject = self.cleaned_data.get('subject')
        name = self.cleaned_data.get('name')
        email = self.cleaned_data.get('email')
        message = self.cleaned_data.get('message')
        message_from = 'From %s <%s>' % (name, email,)
        message = message_from + '\n\n\n' + message

        recipient_list = settings.CONTACT_RECIPIENT_LIST
        sender = settings.DEFAULT_FROM_EMAIL

        send_mail(subject, message, sender, recipient_list, fail_silently=False)

Example 3

Project: acacia_main Source File: collect.py
def send_downgrade_email(customer):
    from django.core.mail import send_mail
    from django.template.loader import render_to_string

    email_content = render_to_string(
        "billing/email_downgrade.txt",
        context={"username":customer.user.username}
    )

    result = send_mail(
        'Acacia Account Downgraded',
        email_content,
        '[email protected]',
        [customer.user.email],
        fail_silently=True
    )
    return result == 1

Example 4

Project: django-socialnews Source File: accounts.py
Function: get
    def get(self, request, username):
        user = User.objects.get(username=username)
        try:
            key = PasswordResetKey.objects.get(user = user)
        except PasswordResetKey.DoesNotExist:
            return HttpResponseForbidden('The key you provided was wrong. Your password could not be reset.')
        request_key = request.GET.get('key', '')
        if request_key == key.key:
            password = helpers.generate_random_key()
            user.set_password(password)
            mail_text = render_to_string('registraion/password_reset_done.txt', dict(user=user, password=password))
            send_mail('Password reset', mail_text, '[email protected]', [user.email])
            key.delete()
            payload = {}
            return render(request, payload, 'registration/password_reset_done.html')
        else:
            return HttpResponseForbidden('The key you provided was wrong. Your password could nit be reset.')

Example 5

Project: django-timepiece Source File: models.py
    def _send_mail(self, subject, ctx):
        # Don't go to the work unless we have a place to send it
        emails = utils.get_setting('TIMEPIECE_ACCOUNTING_EMAILS')
        if not emails:
            return
        from_email = utils.get_setting('DEFAULT_FROM_EMAIL')
        msg = render_to_string('timepiece/contract/hours_email.txt', ctx)
        send_mail(
            subject=subject,
            message=msg,
            from_email=from_email,
            recipient_list=emails
        )

Example 6

Project: hubplus Source File: models.py
Function: message
    def message(self, sender, subject, body) :

        if self.get_user() :
            return self.get_user().message(sender, subject, body)
        else :
            from messages.models import Message
            from django.core.mail import send_mail
            message = _("""

%(sender)s has sent you a new message from %(site_name)s .

%(body)s

""") % {'site_name':settings.SITE_NAME, 'body':body,  'sender':sender.get_display_name()}

            send_mail(subject, message, settings.SUPPORT_EMAIL, [self.email_address],fail_silently=True)
            return False

Example 7

Project: zipfelchappe Source File: views.py
    def send_info_mail(self, request):
        # send mail with payment info
        context = Context({'request': request, 'pledge': self.pledge})
        subject, message = render_mail('cod_wiretransfer', context)

        send_mail(
            subject, message, settings.DEFAULT_FROM_EMAIL,
            [self.pledge.backer.email], fail_silently=False)

Example 8

Project: Resmin Source File: __init__.py
def send_email_from_template(template_name, recipients, context):
    e_subject_path = '%s/%s_subject.txt' % (
        settings.EMAIL_TEMPLATES_PREFIX, template_name)
    e_body_path = '%s/%s_body.txt' % (
        settings.EMAIL_TEMPLATES_PREFIX, template_name)

    e_subject = render_to_string(e_subject_path, context).replace('\n', '')
    e_body = render_to_string(e_body_path, context)

    send_mail(e_subject, e_body, settings.EMAIL_FROM, recipients)

Example 9

Project: telostats Source File: tasks.py
def store_stations(stations):
    logging.debug('Create/update station metadata in Django DB...')
    for station in stations:
        fields = ['longitude', 'latitude', 'name', 'address', 'poles', 'available']
        metadata = dict((f, station[f]) for f in fields)
        obj, created = Station.objects.get_or_create(
            id=station['id'], defaults=metadata)
        if not created:
            obj.poles = station['poles']
            obj.available = station['available']
            obj.save()
        if created and ENV == 'HEROKU':
            raw_msg = get_template('stations/new_station.txt')
            msg = raw_msg.render(Context({'station': obj}))
            send_mail('New Tel-O-Stats station found', msg,
                '[email protected]', ['[email protected]', '[email protected]'])

Example 10

Project: ska Source File: ska_callbacks.py
Function: send_email
    @staticmethod
    def _send_email(group_name, user, request, signed_request_data):
        """
        Custom callback for power users.
        """
        # Sending email to users
        email = signed_request_data.get('email', '')
        first_name = signed_request_data.get('first_name', '')
        if email:
            send_mail(
                _('Welcome!'),
                _("""Dear {0}\nYou have been added to the group power users.\nBest regards""").format(first_name),
                '[email protected]',
                [email],
                fail_silently=True
                )

Example 11

Project: coding-events Source File: event_report_mailer.py
def send_event_report_email(user, event):
    template = loader.get_template("mailer/event_email.txt")
    context = Context({'user': user, 'event': event})

    txt_content = template.render(context)

    send_mail('A new event on codeweek.eu needs your attention',
              txt_content, "[email protected]", [user.email])

Example 12

Project: cgstudiomap Source File: sendtestemail.py
    def handle(self, *args, **kwargs):
        subject = 'Test email from %s on %s' % (socket.gethostname(), timezone.now())

        send_mail(
            subject=subject,
            message="If you\'re reading this, it was successful.",
            from_email=None,
            recipient_list=kwargs['email'],
        )

        if kwargs['managers']:
            mail_managers(subject, "This email was sent to the site managers.")

        if kwargs['admins']:
            mail_admins(subject, "This email was sent to the site admins.")

Example 13

Project: web Source File: views.py
Function: form_valid
    def form_valid(self, form):
        subject = '[studentenportal.ch] Neue Dokument-Meldung'
        sender = settings.DEFAULT_FROM_EMAIL
        receivers = [a[1] for a in settings.ADMINS]
        msg_tpl = 'Es gibt eine neue Meldung zum Dokument "{docuement.name}" ' + \
                  '(PK {docuement.pk}):\n\n' + \
                  'Melder: {name} ({email})\n' + \
                  'Grund: {reason}\n' + \
                  'Nachricht: {comment}\n\n' + \
                  'Link auf Dokument: https://studentenportal.ch{url}'
        admin_url = reverse('admin:docuements_docuement_change', args=(self.object.pk,))
        msg = msg_tpl.format(docuement=self.object, url=admin_url, **form.cleaned_data)
        send_mail(subject, msg, sender, receivers, fail_silently=False)

        return super(DocuementReport, self).form_valid(form)

Example 14

Project: django-ses Source File: backend.py
    def test_return_path(self):
        '''
        Ensure that the 'source' argument sent into send_raw_email uses
        settings.AWS_SES_RETURN_PATH, defaults to from address.
        '''
        settings.AWS_SES_RETURN_PATH = None
        send_mail('subject', 'body', '[email protected]', ['[email protected]'])
        self.assertEqual(self.outbox.pop()['source'], '[email protected]')

Example 15

Project: Misago Source File: testemailsetup.py
Function: send_message
    def send_message(self, email):
        mail.send_mail(
            'Test Message',
            ("This message was sent to test if your "
             "site e-mail is configured correctly."),
            settings.DEFAULT_FROM_EMAIL,
            [email],
            fail_silently=False)
        self.stdout.write("Test message was sent to %s" % email)

Example 16

Project: django-blog-zinnia Source File: moderator.py
    def do_email_notification(self, comment, content_object, request):
        """
        Send email notification of a new comment to site staff.
        """
        site = Site.objects.get_current()
        template = loader.get_template(
            'comments/comment_notification_email.txt')
        context = {'comment': comment, 'site': site,
                   'protocol': PROTOCOL,
                   'content_object': content_object}
        subject = _('[%(site)s] New comment posted on "%(title)s"') % \
            {'site': site.name, 'title': content_object.title}
        message = template.render(context)
        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL,
                  self.mail_comment_notification_recipients,
                  fail_silently=not settings.DEBUG)

Example 17

Project: django-profile Source File: models.py
    def resend(self):
        """
        Resend validation email
        """
        template_body = "userprofile/email/validation.txt"
        template_subject = "userprofile/email/validation_subject.txt"
        site_name, domain = Site.objects.get_current().name, Site.objects.get_current().domain
        key = self.key
        body = loader.get_template(template_body).render(Context(locals()))
        subject = loader.get_template(template_subject).render(Context(locals())).strip()
        send_mail(subject=subject, message=body, from_email=None, recipient_list=[self.email])
        self.created = datetime.datetime.now()
        self.save()
        return True

Example 18

Project: geonode Source File: email.py
Function: send_email
@task(name='geonode.tasks.email.send_email', queue='email')
def send_email(*args, **kwargs):
    """
    Sends an email using django's send_mail functionality.
    """

    send_mail(*args, **kwargs)

Example 19

Project: django-outbox Source File: test_outbox.py
Function: send_mail
    def _send_mail(self, subject='Look at Foo!'):
        sleep(1)

        mail.send_mail(
                subject, 
                'Here is my Foo.', 
                '[email protected]',
                ['[email protected]'])

Example 20

Project: pybbm Source File: compat.py
def send_mass_html_mail(emails, *args, **kwargs):
    """
    Sends emails with html alternative if email item has html content.
    Email item is a tuple with an optionnal html message version :
        (subject, text_msg, sender, recipient, [html_msg])
    """
    for email in emails:
        subject, text_msg, sender, recipient = email[0:4]
        html_msg = email[4] if len(email) > 4 else ''
        if html_msg:
            send_html_mail(subject, text_msg, html_msg, sender, recipient, *args, **kwargs)
        else:
            send_mail(subject, text_msg, sender, recipient, *args, **kwargs)

Example 21

Project: Djrill Source File: test_mandrill_subaccounts.py
    @override_settings(MANDRILL_SUBACCOUNT="legacy_setting_subaccount")
    def test_subaccount_legacy_setting(self):
        mail.send_mail('Subject', 'Body', '[email protected]', ['[email protected]'])
        data = self.get_api_call_data()
        self.assertEqual(data['message']['subaccount'], "legacy_setting_subaccount")

        message = mail.EmailMessage('Subject', 'Body', '[email protected]', ['[email protected]'])
        message.subaccount = "individual_message_subaccount"  # should override legacy setting
        message.send()
        data = self.get_api_call_data()
        self.assertEqual(data['message']['subaccount'], "individual_message_subaccount")

Example 22

Project: django-le-social Source File: views.py
    def send_notification(self):
        context = self.get_notification_context()
        send_mail(
            render_to_string(self.notification_subject_template_name,
                             context).strip(),
            render_to_string(self.notification_template_name, context),
            settings.DEFAULT_FROM_EMAIL,
            [self.user.email],
        )

Example 23

Project: djangae Source File: test_mail.py
    @override_settings(EMAIL_BACKEND='djangae.mail.AsyncEmailBackend')
    def test_send_email_deferred(self):
        """ Test that sending an email using Django results in the email being sent through App
            Engine.
        """
        with sleuth.watch('djangae.mail.aeemail.EmailMessage.send') as gae_send:
            send_mail("Subject", "Hello", self._get_valid_sender_address(), ["[email protected]"])
            self.process_task_queues()
            self.assertTrue(gae_send.called)

Example 24

Project: canvas Source File: api.py
Function: deactivate_user
@api('deactivate')
@require_user
def deactivate_user(request):
    """ Sends us an email. """
    subject = "User deactivation request ({})".format(request.user.username)
    admin_url = 'http://example.com/admin/api_console'
    message = "{}\n\n{}\n\n{}".format(request.user.username, request.user.email, admin_url)
    from_ = "[email protected]"
    to = "[email protected]"
    send_mail(subject, message, from_, [to])

Example 25

Project: django-spreedly Source File: models.py
    def send_activation_email(self):
        if not self.sent_at: #don't spam user with invitations
            send_mail(
                spreedly_settings.SPREEDLY_GIFT_EMAIL_SUBJECT,
                render_to_string(spreedly_settings.SPREEDLY_GIFT_EMAIL, {
                    'message': self.message,
                    'plan_name': self.plan_name,
                    'giver': '%s (%s)' % (self.from_user, self.from_user.email),
                    'site': spreedly_settings.SPREEDLY_SITE_URL,
                    'register_url': self.get_activation_url()
                }),
                settings.DEFAULT_FROM_EMAIL,
                [self.to_user.email,]
            )
            self.sent_at = datetime.today()
            self.save()

Example 26

Project: hue Source File: moderation.py
    def email(self, comment, content_object, request):
        """
        Send email notification of a new comment to site staff when email
        notifications have been requested.

        """
        if not self.email_notification:
            return
        recipient_list = [manager_tuple[1] for manager_tuple in settings.MANAGERS]
        t = loader.get_template('comments/comment_notification_email.txt')
        c = Context({ 'comment': comment,
                      'content_object': content_object })
        subject = '[%s] New comment posted on "%s"' % (get_current_site(request).name,
                                                          content_object)
        message = t.render(c)
        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list, fail_silently=True)

Example 27

Project: indivo_server Source File: utils.py
def send_mail(subject, body, sender, recipient_list):
    # if send mail?
    if settings.SEND_MAIL:
        try:
            mail.send_mail(subject, body, sender, recipient_list)
        except Exception, e:
            logging.error("Exception raised when trying to send the following email: %s" % e)
            logging.error("-----\nFrom: %s\nTo: %s\nSubject: %s\n\n%s\n-----" % (sender, ', '.join(recipient_list), subject, body))
            raise e
    else:
        logging.debug("send_mail to set to false, would have sent email to %s\n\n%s" % (', '.join(recipient_list), body))

Example 28

Project: django-userprofiles Source File: forms.py
    def save(self, user):
        verification = EmailVerification.objects.create(user=user,
            old_email=user.email, new_email=self.cleaned_data['new_email'])

        context = {
            'user': user,
            'verification': verification,
            'site': Site.objects.get_current(),
        }

        subject = ''.join(render_to_string(
            'userprofiles/mails/emailverification_subject.html', context).splitlines())
        body = render_to_string('userprofiles/mails/emailverification.html', context)

        send_mail(subject, body, settings.DEFAULT_FROM_EMAIL,
            [self.cleaned_data['new_email']])

        return verification

Example 29

Project: django-secure-login Source File: on_fail.py
def email_user(username, password, **kwargs):
    try:
        user = User.objects.get(username=username)
        message = render_to_string("secure_login/failed_login_user.txt")
        send_mail("failed_login",
                  message,
                  settings.DEFAULT_FROM_EMAIL,
                  [user.email])

    except User.DoesNotExist:
        pass

Example 30

Project: pythondigest Source File: mail.py
def send_validation(strategy, backend, code):
    url = '{0}?verification_code={1}'.format(reverse('social:complete',
                                                     args=(backend.name,)),
                                             code.code)
    url = strategy.request.build_absolute_uri(url)
    send_mail('Validate your account', 'Validate your account {0}'.format(url),
              settings.EMAIL_FROM, [code.email],
              fail_silently=False)

Example 31

Project: django-oscar Source File: views.py
Function: send_confirmation_email
    def send_confirmation_email(self, real_email, user, password):
        msg = get_template('gateway/email.txt').render(Context({
            'email': user.email,
            'password': password
        }))
        send_mail('Dashboard access to Oscar sandbox',
                  msg, '[email protected]',
                  [real_email])

Example 32

Project: django-locksmith Source File: views.py
def send_key_email(key, email_template):
    email_msg = render_to_string(email_template, {'key': key, 'LOCKSMITH_BASE_TEMPLATE': settings.LOCKSMITH_BASE_TEMPLATE})
    email_subject = getattr(settings, 'LOCKSMITH_EMAIL_SUBJECT',
                            'API Registration')
    send_mail(email_subject, email_msg, settings.DEFAULT_FROM_EMAIL,
              [key.email])

Example 33

Project: djangogirls Source File: community_mails.py
def send_job_mail(subject, message_plain, message_html, recipient):
    send_from = "[email protected]"
    try:
        send_mail(
            subject,
            message_plain,
            send_from,
            [recipient, send_from],
            auth_user=settings.JOBS_EMAIL_USER,
            auth_password=settings.JOBS_EMAIL_PASSWORD,
            html_message=message_html,
        )
        send_status = 'Email to {0} has been sent.'.format(''.join(recipient))
    except SMTPException:
        send_status = 'Something went wrong: email to {0}  \
            has NOT been sent.'.format(
                ''.join(recipient)
            )
    return send_status

Example 34

Project: django-celery-email Source File: tests.py
Function: test_sending_email
    def test_sending_email(self):
        [result] = mail.send_mail('test', 'Testing with Celery! w00t!!', '[email protected]',
                                  ['[email protected]'])
        self.assertEqual(result.get(), 1)
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, 'test')

Example 35

Project: aldryn-events Source File: utils.py
def send_user_confirmation_email(registration, language):
    event = registration.event
    ctx = {
        'event_name': event.title,
        'first_name': registration.first_name,
        'event_url': u"http://%s%s" % (
            Site.objects.get_current(), event.get_absolute_url()
        ),
    }
    subject = render_to_string(
        template_name='aldryn_events/emails/registrant_confirmation.subject.txt',  # NOQA
        dictionary=ctx
    ).strip()
    body = render_to_string(
        template_name='aldryn_events/emails/registrant_confirmation.body.txt',
        dictionary=ctx
    )
    send_mail(subject, body, settings.DEFAULT_FROM_EMAIL,
              recipient_list=[registration.email])

Example 36

Project: python-postmark Source File: forms.py
    def save(self, fail_silently=False):
        """
        Build and send the email message.
        """
        send_mail(subject=unicode(ugettext_lazy(self.cleaned_data['subject'])),
                  message=self.cleaned_data['body'], 
                  from_email=self.cleaned_data['sender'],
                  recipient_list=[addr.strip() for addr in self.cleaned_data['to'].split(',')],
                  fail_silently=fail_silently)

Example 37

Project: feedhq Source File: views.py
    def form_valid(self, form):
        token = signing.dumps(self.request.user.pk, salt='delete_account')
        url = reverse('destroy_confirm', args=[token])
        context = {
            'user': self.request.user,
            'url': url,
            'site': RequestSite(self.request),
            'scheme': 'https' if self.request.is_secure() else 'http',
        }
        body = loader.render_to_string('email/account_delete.txt', context)
        subject = _('FeedHQ account deletion request')
        send_mail(subject, body, settings.DEFAULT_FROM_EMAIL,
                  [self.request.user.email])
        return redirect('destroy_sent')

Example 38

Project: rapidpro Source File: email.py
def send_temba_email(subject, text, html, from_email, recipient_list):
    """
    Actually sends the email. Having this as separate function makes testing multi-part emails easier
    """
    if settings.SEND_EMAILS:
        if html is not None:
            message = EmailMultiAlternatives(subject, text, from_email, recipient_list)
            message.attach_alternative(html, "text/html")
            message.send()
        else:
            send_mail(subject, text, from_email, recipient_list)
    else:
        # just print to console if we aren't meant to send emails
        print "----------- Skipping sending email, SEND_EMAILS to set False -----------"
        print text
        print "------------------------------------------------------------------------"

Example 39

Project: lettuce Source File: moderation.py
    def email(self, comment, content_object, request):
        """
        Send email notification of a new comment to site staff when email
        notifications have been requested.

        """
        if not self.email_notification:
            return
        recipient_list = [manager_tuple[1] for manager_tuple in settings.MANAGERS]
        t = loader.get_template('comments/comment_notification_email.txt')
        c = Context({ 'comment': comment,
                      'content_object': content_object })
        subject = '[%s] New comment posted on "%s"' % (Site.objects.get_current().name,
                                                          content_object)
        message = t.render(c)
        send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, recipient_list, fail_silently=True)

Example 40

Project: django-post_office Source File: test_backends.py
    @override_settings(
        EMAIL_BACKEND='post_office.EmailBackend',
        POST_OFFICE={
            'DEFAULT_PRIORITY': 'now',
            'BACKENDS': {'default': 'django.core.mail.backends.dummy.EmailBackend'}
        }
    )
    def test_default_priority_now(self):
        # If DEFAULT_PRIORITY is "now", mails should be sent right away
        send_mail('Test', 'Message', '[email protected]', ['[email protected]'])
        email = Email.objects.latest('id')
        self.assertEqual(email.status, STATUS.sent)

Example 41

Project: synnefo Source File: notifications.py
    def send(self):
        try:
            send_mail(
                self.subject,
                self.message,
                self.sender,
                self.recipients,
                connection=get_connection())
        except (SMTPException, socket.error), e:
            logger.exception(e)
            raise NotificationError(self)

Example 42

Project: django-mailer Source File: tests.py
    def test_save_to_db(self):
        """
        Test that using send_mail creates a Message object in DB instead, when EMAIL_BACKEND is set.
        """
        self.assertEqual(Message.objects.count(), 0)
        with self.settings(EMAIL_BACKEND="mailer.backend.DbBackend"):
            mail.send_mail("Subject", "Body", "[email protected]", ["[email protected]"])
            self.assertEqual(Message.objects.count(), 1)

Example 43

Project: eyebrowse-server Source File: views.py
@login_required
@ajax_request
def feedback(request):
    """
    Endpoint to submit feedback
    """
    feedback = request.POST.get('feedback', None)
    if not feedback:
        return {'res': 'failed'}

    feedback.replace('\n', '<br>')
    user = request.user
    subject = email_templates.feedback['subject']
    content = email_templates.feedback['content'] % (user.username, feedback)
    admin_emails = [admin[1] for admin in settings.ADMINS]
    send_mail(subject, content, from_email=user.email,
              recipient_list=admin_emails)
    return {'res': 'success'}

Example 44

Project: django-academicstoday Source File: forgot_password.py
def send_email(email, new_password):
    if settings.EMAIL_HOST_USER is '' or settings.EMAIL_HOST_PASSWORD is '':
        return {'status' : 'failed', 'message' : 'cannot change password, emailer is offline, please check back later' }
    
    text = "Your new password is: " + new_password
            
    send_mail(
        "New Password",
        text,
        settings.EMAIL_HOST_USER,
        [email],
        fail_silently=False
    )
    return {'status' : 'success', 'message' : 'successfully registered' }

Example 45

Project: ava Source File: utils.py
def send_mail_smtp(address_to, address_from, message_subject, message_body):
    logger.debug('Function called'
                 ' - utils::send_mail_smtp')
    if not send_mail(message_subject,
                     message_body,
                     address_from,
                     [address_to],
                     fail_silently=True):
        logger.debug('Function error'
                     ' - utils::send_mail_smtp'
                     ' - Failed to send mail')
        return False
    return True

Example 46

Project: talk.org Source File: models.py
Function: email_user
  def email_user(self, subject, message, from_email):
    """Sends an email to this user.

    According to the App Engine email API the from_email must be the
    email address of a registered administrator for the application.
    """
    mail.send_mail(subject,
                   message,
                   from_email,
                   [self.email])

Example 47

Project: django-waitinglist Source File: make_contact.py
    def make_contact(self):
        cards = self.api.cards(self.api.to_contact_list_id)
        for card in cards:
            try:
                entry = WaitingListEntry.objects.filter(initial_contact_sent=False)\
                    .get(trello_card_id=card["id"])
                subject = render_to_string(
                    "waitinglist/email/initial_contact_subject.txt", {"entry": entry})
                message = render_to_string(
                    "waitinglist/email/initial_contact.txt", {"entry": entry})
                send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [entry.email])
                self.api.move_card(card["id"], self.api.contacted_list_id)
                entry.initial_contact_sent = True
                entry.save()
                print "Sent to {0} ({1}) [Card #{2}]".format(
                    card["name"], card["shortUrl"], card["idShort"])
            except WaitingListEntry.DoesNotExist:
                print "{0} ({1}) has already been sent [Card #{2}]".format(
                    card["name"], card["shortUrl"], card["idShort"])

Example 48

Project: pythondotorg Source File: views.py
    def form_valid(self, form):
        self.object = form.save(commit=False)
        if self.request.user.is_authenticated():
            self.object.creator = self.request.user
        self.object.save()

        # Send subscription email to mailing lists
        if settings.MAILING_LIST_PSF_MEMBERS and self.object.psf_announcements:
            send_mail(
                subject='PSF Members Announce Signup from python.org',
                message='subscribe',
                from_email=self.object.creator.email,
                recipient_list=[settings.MAILING_LIST_PSF_MEMBERS],
            )

        return super().form_valid(form)

Example 49

Project: seriesly Source File: models.py
    def send_confirmation_mail(self):
        confirmation_key = self.get_signed_email()
        confirmation_url = settings.DOMAIN_URL + reverse("seriesly-subscription-confirm_mail", args=(self.subkey, confirmation_key))

        sub_url = settings.DOMAIN_URL + reverse("seriesly-subscription-show", args=(self.subkey,))

        subject = "Confirm your seriesly.com email notifications"
        body = """Please confirm your email notifications for your favorite TV-Shows by clicking the link below:

%s

You will only receive further emails when you click the link.
If you did not expect this mail, you should ignore it.
By the way: your Seriesly subscription URL is: %s
    """ % (confirmation_url, sub_url)
        mail.send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, [self.email])

Example 50

Project: dj-dynamic-forms Source File: actions.py
@formmodel_action(ugettext('Send via email'))
def dynamic_form_send_email(form_model, form):
    mapped_data = form.get_mapped_data()

    subject = _('Form “%(formname)s” submitted') % {'formname': form_model}
    message = render_to_string('dynamic_forms/email.txt', {
        'form': form_model,
        'data': sorted(mapped_data.items()),
    })
    from_email = settings.DEFAULT_FROM_EMAIL
    recipient_list = settings.DYNAMIC_FORMS_EMAIL_RECIPIENTS
    send_mail(subject, message, from_email, recipient_list)
See More Examples - Go to Next Page
Page 1 Selected Page 2 Page 3 Page 4