shrijit janbandhu
shrijit janbandhu

Reputation: 1

TypeError at /sendmail/

send_mail() missing 1 required positional argument: 'recipient_list'

In settings.py I added these lines as a setup to send an email

EMAIL_HOST = 'smtp.gmail.com'

EMAIL_PORT = 587

EMAIL_HOST_USER = '[email protected]'

EMAIL_HOST_PASSWORD = '********'

EMAIL_USE_TLS = True

EMAIL_USE_SSL = False

Then in views.py I created the function to send an email

def index(request):

    send_mail(

        'Hello from sender',

        'Hey, how are you?.'

        '[email protected]',

        ['[email protected]'],

        fail_silently=False,

    )

and I got below error

Exception Type: TypeError Exception Value: send_mail() missing 1 required positional argument: 'recipient_list'

Please help me regarding this.....

Upvotes: 0

Views: 701

Answers (1)

shafikshaon
shafikshaon

Reputation: 6404

send_mail() 1st parameter take subject, 2nd parameter take body, 3rd parameter from, 4th parameter take list of recipient address.

You are missing , from 2nd parameter. Try this

send_mail(
    'Hello from sender',
    'Hey, how are you?.',
    '[email protected]',
    ['[email protected]'],
    fail_silently=False,
)

Upvotes: 1

Related Questions