电子邮件,不同的“回复”地址比发件人地址

发布于 2024-10-10 09:02:00 字数 507 浏览 8 评论 0原文

我在网站上有一个联系表单(通用形式:姓名电子邮件主题消息),其中使用 Google 应用 smtp 将邮件发送给管理员。
目前,如果管理员想要直接选择回复选项来回复邮件,则该人回复的收件人字段将自动由发件人地址填充。

我不想问的是,是否有任何标准化方法可以通过邮件传递一些附加信息,从而定义对邮件的任何回复都应发送到此地址而不是发件人的地址?

似乎此选项的机会很小,因为它可能会因垃圾邮件发送者而导致一些问题(他们可能在邮件中定义自定义回复字段,而一般用户可能不会查看他们回复的位置)。

因此,作为替代方案,我认为找到一种方法来创建一个带有发件人帐户的过滤器,该过滤器从格式中找出回复电子邮件地址并转发邮件(似乎不是一个好的解决方案,我不知道如何实现这)。

我已经标记了 django,尽管这与此没有直接关系,因为我最终将通过 django 来实现它。

I have a contact form on a website (a general form: name, email, subject, message) in which mails are sent using google apps smtp to the admins.
Currently if an administrator wants to reply to the mail directly selecting the reply option, the person's reply's To field will be filled by the sender's address automatically.

What I wan't to ask is, Is there any standardized way to pass on some additional info with the mail which would define any reply to the mail should go to this address instead of the sender's?

It does seems that there is a little chance for this option as it may lead to some problems due to spammers (They may define a custom reply field in their mail and a general user might not look where they are replying).

So as an alternative what I thought is to find a way to create a filter with sender's account which figures out the reply email address from the format and forwards the mail (Doesn't seems like a good solution and I have no idea how to achieve this).

I have tagged django, though this is not directly related with this, as I will finally implement this through django.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

饭团 2024-10-17 09:02:00

事实上,有标准化的标头来指定响应标头: http://cr.yp.to/immhf /response.html

至于在 Django 中实现这一点,文档 包含一个示例:

from django.core.mail import EmailMessage

email = EmailMessage(
    'Hello', # email subject
    'Body goes here', # email body
    '[email protected]', # sender address
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    headers={'Reply-To': '[email protected]'},
)

这解决了我的问题。

There are in fact standardized headers to specify response headers: http://cr.yp.to/immhf/response.html.

As far as implementing this in Django is concerned, the documentation contains an example:

from django.core.mail import EmailMessage

email = EmailMessage(
    'Hello', # email subject
    'Body goes here', # email body
    '[email protected]', # sender address
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    headers={'Reply-To': '[email protected]'},
)

This solved my problem.

偏爱你一生 2024-10-17 09:02:00

Reply-To 是标准 SMTP 标头。

目前我找不到很好的参考,但维基百科文章中提到了 Email< /a>.

编辑:找到它:RFC 5322,第3.6.2节

Reply-To is a standard SMTP header.

I can't find a good reference for it at the moment, but it is mentioned in the Wikipedia article on Email.

Edit: Found it: RFC 5322, section 3.6.2

清君侧 2024-10-17 09:02:00

RFC 说您可以指定多个电子邮件,这正是我正在寻找的。想出了这个:

from django.core.mail import EmailMessage
headers = {'Reply-To': '[email protected];[email protected]'}
msg = EmailMessage(subject, html_content, EMAIL_HOST_USER, email_list, headers=headers)
msg.content_subtype = "html"
msg.send()

就像一个魅力。注意:EMAIL_HOST_USER 是根据 Django 文档电子邮件设置从您的设置文件导入的。有关此内容的更多信息,请搜索“回复”: https://docs.djangoproject .com/en/dev/topics/email/

The RFC says you can specify multiple emails and that is what I was looking for. Came up with this:

from django.core.mail import EmailMessage
headers = {'Reply-To': '[email protected];[email protected]'}
msg = EmailMessage(subject, html_content, EMAIL_HOST_USER, email_list, headers=headers)
msg.content_subtype = "html"
msg.send()

Works like a charm. Note: EMAIL_HOST_USER is imported from your settings file as per Django doc email setup. More on this here, search for 'reply-to': https://docs.djangoproject.com/en/dev/topics/email/

も星光 2024-10-17 09:02:00

这也是如何使用reply-to

from django.core.mail import EmailMessage

email = EmailMessage(
    'Hello',
    'Body goes here',
    '[email protected]',
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    reply_to=['[email protected]'],
    headers={'Message-ID': 'foo'},
)

在文档中阅读更多内容 docs .djangoproject

Here is also how reply-to can be used

from django.core.mail import EmailMessage

email = EmailMessage(
    'Hello',
    'Body goes here',
    '[email protected]',
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    reply_to=['[email protected]'],
    headers={'Message-ID': 'foo'},
)

Read more at docs docs.djangoproject

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文