Re: Resend emails from a Maildir

2010-10-20 Thread mouss

 Le 19/10/2010 21:22, Victor Duchovni a écrit :

On Mon, Oct 18, 2010 at 11:37:18PM +0200, mouss wrote:


- get the MAIL FROM address from the Return-Path header. with this you
can do: sendmail -f $returnpath yourdestinationemail

Make that:

sendmail -i -f $returnpath -- $destpath  msgfile

The returnpath can have all kinds of interesting characters.


indeed.


  If using
Perl, it is highly advisable to entirely bypass shell argument parsing:

$prog = /usr/sbin/sendmail;
@rcpts = ( q{...@example.com} );
@args = qw(sendmail -i);
push(@args, -f, $envsender);
push(@args, --, @rcpts);
system { $prog } @args;
if (($code = $?) ne 0) {
# handle errors
}





Re: Resend emails from a Maildir

2010-10-19 Thread Roberto Scattini
On Mon, Oct 18, 2010 at 6:56 AM, Patric Falinder patric.falin...@omg.nuwrote:

 Hi,

 I'm not really sure if this has to do with Postifx so just tell me if I'm
 wrong.

 Is it possible to resend emails that are in a Maildir already?
 The reason for this is that a user changed server so I had to change the
 transport for that domain and there are something like 50 mails in the old
 Maildir that I need to resend to the new server.

 Is that possible?


 Thanks,
 -Patric



maybe imapsync?


-- 
Roberto Scattini
 ___ _
 ))_) __ )L __
((__)(('(( ((_)


Re: Resend emails from a Maildir

2010-10-19 Thread Victor Duchovni
On Mon, Oct 18, 2010 at 11:37:18PM +0200, mouss wrote:

 - get the MAIL FROM address from the Return-Path header. with this you 
 can do: sendmail -f $returnpath yourdestinationemail

Make that:

sendmail -i -f $returnpath -- $destpath  msgfile

The returnpath can have all kinds of interesting characters. If using
Perl, it is highly advisable to entirely bypass shell argument parsing:

$prog = /usr/sbin/sendmail;
@rcpts = ( q{...@example.com} );
@args = qw(sendmail -i);
push(@args, -f, $envsender);
push(@args, --, @rcpts);
system { $prog } @args;
if (($code = $?) ne 0) {
# handle errors
}

-- 
Viktor.


Resend emails from a Maildir

2010-10-18 Thread Patric Falinder

Hi,

I'm not really sure if this has to do with Postifx so just tell me if 
I'm wrong.


Is it possible to resend emails that are in a Maildir already?
The reason for this is that a user changed server so I had to change the 
transport for that domain and there are something like 50 mails in the 
old Maildir that I need to resend to the new server.


Is that possible?


Thanks,
-Patric


Re: Resend emails from a Maildir

2010-10-18 Thread anant

Run, sendmail -q

Regards,
ANANT.

Quoting Patric Falinder patric.falin...@omg.nu:


Hi,

I'm not really sure if this has to do with Postifx so just tell me  
if I'm wrong.


Is it possible to resend emails that are in a Maildir already?
The reason for this is that a user changed server so I had to change  
the transport for that domain and there are something like 50 mails  
in the old Maildir that I need to resend to the new server.


Is that possible?


Thanks,
-Patric





--
Confidentiality Notice: This e-mail message, including any attachments, is for
the sole use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the intended recipient, please
contact the sender by reply e-mail and destroy all copies of the original
message.
--



Re: Resend emails from a Maildir

2010-10-18 Thread Ralf Hildebrandt
* Patric Falinder patric.falin...@omg.nu:
 Hi,
 
 I'm not really sure if this has to do with Postifx so just tell me if
 I'm wrong.
 
 Is it possible to resend emails that are in a Maildir already?

Yes.

#!/bin/sh

#
#  verschickt die gesamte Mail eines Benutzers an $1
#
USAGE=usage: $0 u...@domain

if test $# != 1
then
echo $USAGE
exit 1
fi

if  ! grep @ STOP  /dev/null
$1
STOP
then
echo $USAGE
echo No @ in Mail-address
exit 1
fi

if !  test -d new -a -d cur -a tmp
then
echo You are not in Maildir
echo there is no new cur tmp
exit 1
fi


find cur new tmp -type f | xargs --replace /usr/local/scripts/send_mail $1 {}



/usr/local/scripts/send_mail

#!/bin/sh
/usr/local/sbin/mini_sendmail -syour.mail.host -p25 -fnob...@charite.de $1  $2 
 rm -f $2

-- 
Ralf Hildebrandt
  Geschäftsbereich IT | Abteilung Netzwerk
  Charité - Universitätsmedizin Berlin
  Campus Benjamin Franklin
  Hindenburgdamm 30 | D-12203 Berlin
  Tel. +49 30 450 570 155 | Fax: +49 30 450 570 962
  ralf.hildebra...@charite.de | http://www.charite.de



Re: Resend emails from a Maildir

2010-10-18 Thread Michael Tokarev
18.10.2010 16:43, Ralf Hildebrandt wrote:
[]
 if  ! grep @ STOP  /dev/null
 $1
 STOP
 then

Now that's interesting construct ;)

case $1 in
  ?...@?*) ;;
  *) echo No @ in Mail-address 2; exit 1;;
esac

/mjt


Re: Resend emails from a Maildir

2010-10-18 Thread Patric Falinder

Ralf Hildebrandt skrev 2010-10-18 14:43:

* Patric Falinderpatric.falin...@omg.nu:

Hi,

I'm not really sure if this has to do with Postifx so just tell me if
I'm wrong.

Is it possible to resend emails that are in a Maildir already?


Yes.

#!/bin/sh

#
#  verschickt die gesamte Mail eines Benutzers an $1
#
USAGE=usage: $0 u...@domain

if test $# != 1
then
echo $USAGE
exit 1
fi

if  ! grep @STOP  /dev/null
$1
STOP
then
echo $USAGE
echo No @ in Mail-address
exit 1
fi

if !  test -d new -a -d cur -a tmp
then
echo You are not in Maildir
echo there is no new cur tmp
exit 1
fi


find cur new tmp -type f | xargs --replace /usr/local/scripts/send_mail $1 {}



/usr/local/scripts/send_mail

#!/bin/sh
/usr/local/sbin/mini_sendmail -syour.mail.host -p25 -fnob...@charite.de $1  
$2  rm -f $2


Thanks a lot, will try that! :)

-Patric


Re: Resend emails from a Maildir

2010-10-18 Thread mouss

 Le 18/10/2010 11:56, Patric Falinder a écrit :

Hi,

I'm not really sure if this has to do with Postifx so just tell me if 
I'm wrong.


Is it possible to resend emails that are in a Maildir already?
The reason for this is that a user changed server so I had to change 
the transport for that domain and there are something like 50 mails in 
the old Maildir that I need to resend to the new server.


Is that possible?



if it's maildir at both sides, the simple thing is to copy the files 
(cp, scp, rync, ... etc.)


if you believe smtp is the right transport, then:
- you'll need to make sure the Delivered-To header does not match the 
next destination address (otherwise, Mr postfix will think this is a loop)
- get the MAIL FROM address from the Return-Path header. with this you 
can do: sendmail -f $returnpath yourdestinationemail