用第三方电子邮件替换 Django SMTP triggers/events/attributes

Replacing Django SMTP with third party email triggers/events/attributes

在 URL 文件中调用密码重置:

url(r'^password/reset/$', 
       auth_views.password_reset, {
           'post_reset_redirect': 'auth_password_reset_done',
           'template_name': 'auth/password_reset_form.html',
           'password_reset_form': AccountPasswordResetForm,
           'email_template_name': 'auth/password_reset_email.html',
           },
       name='auth_password_reset'),

我需要将一些事件和属性发送到我的第三方电子邮件提供商,而不是通过 SMTP 发送电子邮件“password_reset_email.html”。 我该怎么做呢?也许通过改变 password_reset() 功能?或者有更好的方法吗?

我会在我的应用程序中创建一个新功能 views.py:

def my_password_reset(request, *args, **kwargs):
    # Do the additional bussiness here
    send_some_events()
    # And then do the password reset as usual.
    auth.views.password_reset(request, *args, **kwargs)

urls.py 的呼叫更改为:

url(r'^password/reset/$', 
   my_app.views.my_password_reset, ...