#!/usr/bin/perl -w use strict; my $email; while() { $email.=$_; } use MIME::Lite; use Net::SMTP; my $from_address = 'Mail Delivery System '; my $to_address = $1 if $email =~ /^Return-Path:\s*(.*)/; my $recip = $1 if $email =~ /\nTo:\s*(.*)/; my $orig_subj = $1 if $email =~ /\nSubject:\s*(.*)/; my $mail_host = 'mail.szegedvaros.hu'; my $subject = 'Undelivered Mail Returned to Sender - User is over quota!'; my $message_body = " This is the Postfix program at host mail.szegedvaros.hu. I'm sorry to have to inform you that your message could not be be delivered to one or more recipients. It's attached below. For further assistance, please send mail to If you do so, please include this problem report. You can delete your own text from the attached returned message. The Postfix program $recip: User is over quota! "; my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; $msg->attach ( Type => 'TEXT', Data => $message_body ) or die "Error adding the text message part: $!\n"; $msg->attach ( Type => 'message/rfc822', Data => $email, Filename => $orig_subj, Disposition => 'attachment' ) or die "Error adding attachement: $!\n"; ### Send the Message MIME::Lite->send('smtp', $mail_host, Timeout=>60); $msg->send; exit 0;