[英]Getting Error when trying to Generate password reset email link in django using firebase SDK
email = 'user@example.com'
link = auth.generate_password_reset_link(email, action_code_settings)
# Construct password reset email from a template embedding the link, and send
# using a custom SMTP server.
send_custom_email(email, link)
So I'm using this code from https://firebase.google.com/docs/auth/admin/email-action-links#python in django所以我在 django 中使用来自https://firebase.google.com/docs/auth/admin/email-action-links#python的代码
and I'm getting this error:我收到了这个错误:
NameError: name 'send_custom_email' is not defined
And nothing is mentioned in the documentation.文档中没有提到任何内容。 So if anyone knows the solutions it would be great.
因此,如果有人知道解决方案,那就太好了。
sg = SendGridAPIClient(os.environ["SENDGRID_API_KEY"])
html_content = f"""
<p>Hello,</p>
<p>Follow this link to reset password</p>
<p>{link}</p>
<p>If you didn't ask to reset the password, you can ignore this
email.</p>
"""
message = Mail(
to_emails=xyz@gmail.com,
from_email=Email('abc@gmail.com', "ABC System")
subject="Reset your password for ABC System",
html_content=html_content
)
try:
response = sg.send(message)
print(response.status_code)
except HTTPError as e:
print(e.message)
The above script is used for sending an email using Sendgrid.上述脚本用于使用 Sendgrid 发送 email。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.