通过Google Apps向Django发送电子邮件时,可以给电子邮件帐户一个名称 [英] Giving email account a name when sending emails with Django through Google Apps

查看:170
本文介绍了通过Google Apps向Django发送电子邮件时,可以给电子邮件帐户一个名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Google Apps向使用Django的用户发送电子邮件。

I am sending emails to users using Django through Google Apps.

当用户收到从Django应用发送的电子邮件时,他们来自:
do_not_reply@domain.com

When the user receives emails sent from the Django app, they are from:
do_not_reply@domain.com

当查看收件箱中的所有电子邮件时,人们会看到电子邮件的发件人:

do_not_reply do_not_reply@domain.com 取决于使用的电子邮件客户端

when looking at all emails in the inbox, people see the email's sender as :
do_not_reply or do_not_reply@domain.com depending on the email client used

如果我使用浏览器和Google Apps本身登录了do_not_reply帐户,然后发送电子邮件给自己,电子邮件来自:
不要回覆< do_not_reply@domain.com>

If I log into that "do_not_reply" account using the browser and Google Apps itself and then send an email to myself, the emails are from:
Dont Reply<do_not_reply@domain.com>

因此,收件箱中电子邮件发件人显示的名称是:

不要回复

As a result, the name displayed for the email's sender in the inbox is:
Dont Reply

在Django中,有没有办法附加一个名字给用于发送电子邮件的电子邮件帐户?

In Django, is there a way to attach a "name" to the email account being used to send emails?

我已经查看过Django的mail.py,但没有找到解决方案

http://code.djangoproject.com/browser/django/trunk/django/core/mail.py?rev= 5548

I have reviewed Django's mail.py, but had no luck finding a solution
http://code.djangoproject.com/browser/django/trunk/django/core/mail.py?rev=5548

使用:

Django 1.1

Python 2.6

Ubuntu 9.1 < br>
settings.EMAIL_HOST ='smtp.gmail.com'

Using:
Django 1.1
Python 2.6
Ubuntu 9.1
settings.EMAIL_HOST = 'smtp.gmail.com'

谢谢

推荐答案

您可以使用不要回复&do@ot_not_reply@domain.com>作为您发送的电子邮件地址。

You can actually use "Dont Reply <do_not_reply@domain.com>" as the email address you send from.

在django项目的shell中尝试这个,以测试它是否也适用于gapps:

Try this in the shell of your django project to test if it also works with gapps:

>>> from django.core.mail import send_mail
>>> send_mail('subject', 'message', 'Dont Reply <do_not_replay@domain.com>', ['youremail@example.com'])

这篇关于通过Google Apps向Django发送电子邮件时,可以给电子邮件帐户一个名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆