发送邮件提醒

邮件提醒会使某些功能有更好的用户体验, 比如发送邮件提醒用户新消息到达. 请在seahub_settings.py中加入以下语句以开启邮件提醒功能 (同时需要对你的邮箱进行设置).

  EMAIL_USE_TLS = False
  EMAIL_HOST = 'smtp.domain.com'        # smpt 服务器
  EMAIL_HOST_USER = 'username@domain.com'    # 用户名和域名
  EMAIL_HOST_PASSWORD = 'password'    # 密码
  EMAIL_PORT = '25'
  DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  SERVER_EMAIL = EMAIL_HOST_USER

Gmail 邮箱示例:

  EMAIL_USE_TLS = True
  EMAIL_HOST = 'smtp.gmail.com'
  EMAIL_HOST_USER = 'username@gmail.com'
  EMAIL_HOST_PASSWORD = 'password'
  EMAIL_PORT = '587'
  DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  SERVER_EMAIL = EMAIL_HOST_USER

QQ 邮箱示例:

  EMAIL_USE_SSL = True
  EMAIL_HOST = 'smtp.qq.com'
  EMAIL_HOST_USER = 'username@domain.com'
  EMAIL_HOST_PASSWORD = 'Auth_Code'
  EMAIL_PORT = '465'
  DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  SERVER_EMAIL = EMAIL_HOST_USER

注意:QQ邮箱的配置示例中,'EMAIL_HOST_PASSWORD'并非是邮箱账号的登陆密码,而是一个16位的授权码,获取此授权码的详细流程请参考:http://service.mail.qq.com/cgi-bin/help?subtype=1&&no=1001256&&id=28

163 邮箱未测试成功 (有些国内公共邮箱做了限制的,是不能配置成功的.)

126 邮箱:

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.vip.126.com'
EMAIL_HOST_USER = 'test@vip.126.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = '587'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

注意1:关于如何正确使用465端口和587端口:

注意2:如果邮件功能不能正常使用,请在logs/seahub.log日志文件中查看问题原因.

推荐以下调试方法:

注意3: 如果你想在非用户验证情况下使用邮件服务,请将EMAIL_HOST_USEREMAIL_HOST_PASSWORD 置为blank (''). (但是注意一点,这种情况下,邮件将不会记录发件人From:信息.)

注意4:

Last modified by Daniel Pan, 2019-05-18