1
Setting.py-

EMAIL_BACKEND = "mailer.backend.DbBackend"
EMAIL_SUBJECT_PREFIX = "[.....]"

EMAIL_HOST          = 'smtp.gmail.com'
EMAIL_HOST_PASSWORD = 'tester@@abcd'
EMAIL_HOST_USER     = 'tester.abcd@gmail.com'
EMAIL_PORT          = 587
EMAIL_USE_TLS       = True

DEFAULT_FROM_EMAIL  = 'tester.abcd@gmail.com'
DEFAULT_ADMIN_EMAIL  = 'tester.abcd@gmail.com'
TEMPORARY_CC_EMAIL = 'tester.abcd@gmail.com'
CONTACTUS_EMAIL = 'tester.abcd@gmail.com'
JOBAPPLY_EMAIL = 'tester.abcd@gmail.com'

urls.py:

urlpatterns = patterns('django.contrib.auth.views',
 url(r'^password-reset/$', 'password_reset', {
      'template_name': 'profiles/password_reset_form.html',
    'password_reset_form': PassResetForm
  }, name='password-reset'),
 url(r'^password-reset-process/$', 'password_reset_done', {
    'template_name': 'profiles/password_reset_done.html',
  }, name='password-reset-done'),
 url(r'^password-reset-confirm/(?P<uidb36>[0-9a-zA-Z]{1,13})-(?P<token>.+)/$',
    'password_reset_confirm',
    {'template_name': 'profiles/password_reset_confirm.html',},
    name='password-reset-confirm'),
 url(r'^password-reset-complete', 'password_reset_complete', {
    'template_name': 'profiles/password_reset_complete.html',
  }, name='password-reset-complete'),

这是我的代码,当我输入我的邮件并单击提交时,它正确重定向到下一页但邮件没有发送,这个代码有什么 pblm

4

1 回答 1

0

您应该首先测试问题是来自您的代码还是来自电子邮件后端。

以下是设置 Django 控制台电子邮件后端的方法:

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

当您在本地开发机器上运行服务器时,这应该会在控制台中输出电子邮件python manage.py runserver

如果电子邮件正确打印到控制台中,那么您的配置有问题:

EMAIL_HOST          = 'smtp.gmail.com'
EMAIL_HOST_PASSWORD = 'tester@@abcd'
EMAIL_HOST_USER     = 'tester.abcd@gmail.com'
EMAIL_PORT          = 587
EMAIL_USE_TLS       = True

或在这里:

EMAIL_BACKEND = "mailer.backend.DbBackend"
于 2013-10-07T07:31:24.473 回答