VERP和perl后缀不起作用 [英] VERP and perl postfix not working

查看:224
本文介绍了VERP和perl后缀不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个脚本,我试图使VERP正常运行。它使用MIME :: Lite和postfix作为邮件服务器。这里是代码:

  use strict; 
使用MIME :: Lite;
使用LWP :: Simple;
使用Mail :: Verp;

我的$ email ='someuser@somesite.com';
Mail :: Verp-> separator('+');
我的$ verp_email = Mail :: Verp-> encode('root@somesite.net',$ email);
我的$ content ='< html>< body>嗨!< / body>< / html>';
我的$ msg = MIME :: Lite-> new(
Subject =>'嗨',
From =>'root@somesite.net',
= $ $,
'Return-Path'=> $ verp_email
Type =>'text / html',
Data => $ content
) ;
$ msg-> send('smtp','XXX.XXX.XXX.XXX');

当邮件退回后,postfix不将其路由到root@somesite.net电子邮件收件箱。我如何路由邮件,以便反弹的发件人是$ verp_email值?



我正在尝试使用电子邮件地址创建所有退回邮件的日志包括在内,以便可以将其发送到文件或数据库。



如果有人可以指出我正确的方向,我将非常感激。
谢谢。

解决方案

这个问题有点老了,但希望我的答案将有助于找到这个的人谷歌搜索。
我有同样的问题,根本原因是在与目标服务器的smtp交换期间必须使用MAIL FROM:。
设置MIME :: Header中的返回路径由smtp服务器本身精确地基于MAIL FROM smtp命令覆盖。
所以你可以有一个包含From:root@somesite.net的邮件信封,但确保smtp MAIL FROM使用$ verp_email
例如,这是我已经完成的:

  my $ msg = MIME :: Entity-> build(
'Return-Path'=>'bounce + user = user-domain .com @ my-server.com',
'From'=>'admin@my-server.com',
'To'=>'user@user-domain.com'
'Subject'=> $ subject,
'Errors-To'=>'bounce+user=user-domain.com@my-server.com'
);
##然后一些更多的处理与MIME :: Entity
##最后发送它通过smtp

我的@rcpt = $ msg-> smtpsend(
## make make verbose for debug
'Debug'=> DEBUG,
'Hello'=>'mx1.my-server.com',
'Host'=>' mx.user-domain.com,
'MailFrom'=>'bounce+user=user-domain.com@my-server.com',
'To'=>'user @ user -domain.com',
'Port'=> 25,
);


So I have a script that I'm trying to get VERP running correctly on. It's using MIME::Lite and postfix as the mail server. Here is the code:

use strict;
use MIME::Lite;
use LWP::Simple;
use Mail::Verp;

my $email = 'someuser@somesite.com';
Mail::Verp->separator('+');
my $verp_email = Mail::Verp->encode('root@somesite.net', $email);
my $content = '<html><body>Hi!</body></html>';
my $msg = MIME::Lite->new(
    Subject => 'Hi',
    From => 'root@somesite.net',
    To => $email,
    'Return-Path' => $verp_email,
    Type => 'text/html',
    Data => $content
);
$msg->send('smtp', 'XXX.XXX.XXX.XXX');

When the message is bounced postfix isn't routing it to the root@somesite.net email inbox. How do I route the message so that the sender of the bounce is the $verp_email value?

I'm trying to create a log of all bounced emails with the email addresses included so that it can then be sent to a file or a database.

If anyone can point me in the right direction with this I would be extremely appreciative. Thanks.

解决方案

The question is a bit old, but hopefully my answer will contribute to someone who find this while googling. I had the same problem, and the root cause is that you must use "MAIL FROM: " during the smtp exchange with the target server. Setting the return-path in the MIME::Header gets overwriten by the smtp server itself precisely based on the MAIL FROM smtp command. So you can have a Mail envelope containing From: root@somesite.net but make sure the smtp MAIL FROM uses $verp_email For example, this is what I have done:

my $msg = MIME::Entity->build(
    'Return-Path'   => 'bounce+user=user-domain.com@my-server.com',
    'From'      => 'admin@my-server.com',
    'To'        => 'user@user-domain.com',
    'Subject'   => $subject,
    'Errors-To' => 'bounce+user=user-domain.com@my-server.com'
);
## Then some more handling with MIME::Entity
## and finally send it over smtp

my @rcpt = $msg->smtpsend(
    ## Make it verbose for debugging
    'Debug'     => DEBUG,
    'Hello'     => 'mx1.my-server.com',
    'Host'      => 'mx.user-domain.com,
    'MailFrom'  => 'bounce+user=user-domain.com@my-server.com',
    'To'        => 'user@user-domain.com',
    'Port'      => 25,
);

这篇关于VERP和perl后缀不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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