Friday, May 1, 2020

Trying to send mails from website

Hi guys,

 

I am using Celery and Eventlet to facilitate a task which sends emails.  I am using the following code:

 

@task

def order_created(order_id):

    """

    Task to send an e-mail notification when an order is

    successfully created.

    """

    order = Order.objects.get(id=order_id)

    subject = 'Order nr. {}'.format(order.id)

    message = 'Dear {},\n\nYou have successfully placed an order.\

                    Your order id is {}.'.format(order.first_name,

                                                 order.id)

    mail_sent = send_mail(subject,message,settings.EMAIL_HOST_USER,[order.email],fail_silently=False)

   

 

    return mail_sent

 

I get the following error

 

TypeError: wrap_socket() got an unexpected keyword argument '_context'

 

Can anyone assist?

I am using Python 3.8

Celery 4.4.2

Eventlet 0.25.2

Django 2.2.12

 

 

Sent from Mail for Windows 10

 

No comments:

Post a Comment