我正在尝试设置我的应用,以便从GoDaddy提供的office365电子邮件中发送电子邮件。有similar question here,但显然设置不起作用。我也使用了settings here,当我尝试发送电子邮件时出现Service unavailable
错误。
我的设置。
EMAIL_HOST = 'smtp.office365.com'
EMAIL_HOST_USER = 'admin@******.com'
EMAIL_HOST_PASSWORD = '********'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
我得到了
SMTPServerDisconnected at /contact-us/
Service unavailable
答案 0 :(得分:1)
找到解决方案。我使用ping smtp.office365.com
返回outlook-emeasouth2.office365.com
作为DNS名称。使用我的完整office365电子邮件地址和密码使用此主机!
设置
EMAIL_HOST = 'outlook-namnorth.office365.com'
EMAIL_HOST_USER = 'admin@******.com'
EMAIL_HOST_PASSWORD = '********'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
dig smtp.office365.com
会返回一堆主机,我想这取决于位置。
; <<>> DiG 9.9.2-P1 <<>> smtp.office365.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12153
;; flags: qr rd ra; QUERY: 1, ANSWER: 14, AUTHORITY: 7, ADDITIONAL: 12
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;smtp.office365.com. IN A
;; ANSWER SECTION:
smtp.office365.com. 269 IN CNAME smtp.outlook.office365.com.
smtp.outlook.office365.com. 269 IN CNAME outlook.office365.com.
outlook.office365.com. 294 IN CNAME outlook.ha.office365.com.
outlook.ha.office365.com. 3 IN CNAME outlook- emeasouth2.office365.com.
outlook-emeasouth2.office365.com. 273 IN A 40.101.7.194
outlook-emeasouth2.office365.com. 273 IN A 40.101.44.138
outlook-emeasouth2.office365.com. 273 IN A 40.101.6.90
outlook-emeasouth2.office365.com. 273 IN A 40.101.55.210
outlook-emeasouth2.office365.com. 273 IN A 40.101.29.114
outlook-emeasouth2.office365.com. 273 IN A 40.101.5.130
outlook-emeasouth2.office365.com. 273 IN A 40.101.4.2
outlook-emeasouth2.office365.com. 273 IN A 40.96.33.178
outlook-emeasouth2.office365.com. 273 IN A 132.245.55.178
outlook-emeasouth2.office365.com. 273 IN A 40.101.54.114