i have a user model where after creating the model I want to send email from signal.
I have a function in my signals.py
def notify_after_registration(sender, instance, created, **kwargs):
user = instance.username
email_subject = 'Account confirmation'
email_body = "some message"
send_mail(
email_subject,
email_body,
settings.EMAIL_HOST_USER,
[instance.email,
fail_silently=False
)
at the bottom i have
post_save.connect(notify_after_registration, sender=User)
When I register the user user is saved but email is not sent.. What is wrong ?