设置电子邮件标题,以便反弹的电子邮件转到特定的地址 [英] Set email headers so bounced emails go to a specific address

查看:245
本文介绍了设置电子邮件标题,以便反弹的电子邮件转到特定的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我们的rails应用程序,我们发送一些系统生成的电子邮件,from地址设置为noreply@ourdomain.com。如果这些反弹,我们的邮件服务器就会发回这个地址。但是,我想做的是不要将退回的邮件发送回noreply@ourdomain.com,而是发送到另一个地址,例如bounced@ourdomain.com。

From our rails app we send out some system-generated emails with the 'from' address set to noreply@ourdomain.com. If these bounce they get sent back to this address by our mail server. However, what i'd like to do is to not have bounced emails get sent back to noreply@ourdomain.com but to a different address, such as bounced@ourdomain.com.

有没有标题或我可以在电子邮件中设置的东西来实现这一点,没有我不必去调查我们的电子邮件服务器的变幻莫测?我们使用exim发送邮件,以防相关。

Is there a header or something i can set in the email that will achieve this, without me having to go and investigate the vagaries of our email server? We send the mails out using exim in case that's relevant.

cheers,max

cheers, max

推荐答案

我只是在阅读关于exim配置的很多之后,在exim4中找到了这个。

I just figured this out myself in exim4 after a lot of reading about exim configuration.

首先,你想要你的应用程序添加以下标题:

First, you want your app to add the following header:

Return-Path: <bounced@yourdomain.com>

适用于或不带括号。 Exim将以任何一种方式添加括号。

Works with or without brackets. Exim will add brackets in the end either way.

其次,这是很难的部分。 Exim总是希望用发送它的unix用户覆盖我的Return-Path:地址。您可以使用Ubuntu中的/ etc / email-address为您的Web应用程序的用户设置静态电子邮件,但这仍然忽略了Return-Path头。这是我如何修改我的exim配置,以从网络应用程序尊重返回路径:

Second, this was the hard part. Exim always wanted to override my Return-Path: address with the unix user who sent it. You can use /etc/email-addresses in Ubuntu to set a static email for the user of your web app, but this still ignores the Return-Path header. Here is how I modified my exim config to respect the Return-Path from the web app:

在主配置区域添加:

return_path_remove = false

在适当的路由器配置(例如dnslookup):

In the appropriate router config (e.g. dnslookup):

dnslookup:
  # ...
  errors_to = ${if def:h_return-path: {${address:$h_return-path:}} fail}
  headers_remove = return-path
  no_more

现在,exim应该在信封级复制Return-Path头地址,并删除原始的Return-Path头。

Now exim should copy the Return-Path header address at the envelope-level and delete the original Return-Path header.

我尝试了很多其他的配置指令,这是我唯一可行的方法。

I tried lots of other configuration directives and this is the only way that actually worked for me.

这篇关于设置电子邮件标题,以便反弹的电子邮件转到特定的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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