虽然小但令人讨厌的问题,我已经安装我的django应用程序来使用我公司的Gmail帐户发送电子邮件。发送工作正常,但从电子邮件始终是gmail帐户。这里是我的设置/代码 - 我已经改变了所有的地址等,但要确保一切工作正常,除了从电子邮件。从地址发送的电子邮件是与Django的gmail
def send_discrepency_email(action, cart, atype):
r = False
user = cart.user
subject = "%s - User Discrepency Response for order %s (%s)" % (action.upper(), cart.web_order_id, cart.syspro_order_id)
message = "The user %s (%s) has opted to %s his/her order with the following discrepency type: %s." %(user.email, user.customer_id, action.upper(), atype)
try:
e = EmailMessage(subject, message, '[email protected]', ["[email protected]", "[email protected]"])
e.send(fail_silently=False)
r = True
except Exception as e:
print "Error sending discrepency email: %s" % e
return r
注:代码我也试过用头kwarg无济于事覆盖。
DEFAULT_FROM_EMAIL = "[email protected]"
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'fakepword'
EMAIL_PORT = 587
这是甚至可以与gmail,我发誓我曾经使用过一次,它工作正常。
总之,不管什么样的变化我做,邮件的发送总是[email protected]
你的意思是说“from”是“ecommerce_requests @ rokkyy.com”而不是'no-reply'? – karthikr
不,对不起,从电子邮件总是[email protected]而不是没有答复。我只是在发布之前添加了SERVER_EMAIL设置,看看它是否有帮助,我将从我的示例中删除。 – picus
你有没有解决过这个问题,还是使用GMAIL不可能? –