2014-04-18 2 views
0

내 필터 스크립트에서 오류 정보를 표시하는 반송파 메시지를 후위 생성합니다. 나는 내가 모든 데이터가 표준 출력에 인쇄 된 것을 볼 것이지만 스크립트 파일에 대한 정보도 볼 것입니다. 내가 그런에만 뭔가 갖고 싶어스크립트에서 오류 정보가 포함 된 Postfix 반송 메시지

This is the mail system at host mail.somesys.pl. 

I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below. 

For further assistance, please send mail to postmaster. 

If you do so, please include this problem report. You can delete your own text from the attached returned message. 

        The mail system 

<[email protected]>: Command died with status 1: 
    "/opt/SmtpReceiver/SmtpReceiverHandler.py". Command output: NO FILES OR BAD 
    CREDENTIALS 

그리고 : : 예를 들어

... 
        The mail system 

NO FILES OR BAD CREDENTIALS 

내 후위 master.cf 설정 :

smtp  inet n  -  n  -  -  smtpd 
     -o content_filter=myhook:dummy 
... 
myhook unix - n n - - pipe 
    flags=F user=user01 argv=/opt/SmtpReceiver/SmtpReceiverHandler.py ${sender} ${size} ${recipient} 

그리고 파이썬 스크립트 :

if __name__=='__main__': 

    try: 
     app = SmtpReceiverHandler(); 
     app.run(); 
    except Exception, e: 
     print e; 
     sys.exit(1); 

답변

1

을 지정할 수 있습니다. 당신의 main.cf

#/etc/postfix/main.cf 
bounce_template_file = /etc/postfix/bounce.cf 

#/etc/postfix/bounce.cf 
failure_template = <<EOF 
Charset: us-ascii 
From: MAILER-DAEMON (Mail Delivery System) 
Subject: Undelivered Mail Returned to Sender 
Postmaster-Subject: Postmaster Copy: Undelivered Mail 

    The mail system 
EOF 

참조에: Postfix docs

+0

감사하지만 (지금은) 기본 템플릿을 변경하지 않습니다. 내가 원하는 것은 바운스 메시지 끝에 필터 스크립트의 출력을 추가하는 것이지만 파일에 대한 정보는 없다. – Logman

+0

나는 그것이 가능하다고 생각하지 않는다. – clement