By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,108 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

Bounce Email

P: n/a
Hi!

I'm trying to do the following:

-Extract an Email from a mailbox using grepmail
-Bounce this Email to a different address

I thought that this would be an easy thing to do, but I still haven't manage
to do it the way I want to.

The problem is MIME encoded messages.
I've tried several approches, but I always get the same result: the Email
Content-type is always text/plain after I've sent it.
It seems like some of the header is stripped off.

Here is my code:

##########################################
....
use MIME::Parser;
use MIME::Entity;
use MIME::Head;

my $sCmd = "grepmail -iu -Y \'(\^From:)\' $sMyAddress $sPathToMailbox;
my @EmailLines = `$sCmd`;

my $oParser = new MIME::Parser;
my $oEmail = $oParser->parse_data(\@EmailLines);
$oEmail->head->replace("To", $sBounceAddress);

my $sRes = $oEmail->smtpsend;
....
##########################################

Does anyone have a suggestion on how I can forward the mail without
stripping the header?

Thanx in advance!

-Nils Magne Lunde
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Never mind, I managed to fix it myself.

-Nils Magne

"Nils M. Lunde" <ni****@options.no.nospam> wrote in message
news:RP********************@giganews.com...
Hi!

I'm trying to do the following:

-Extract an Email from a mailbox using grepmail
-Bounce this Email to a different address

I thought that this would be an easy thing to do, but I still haven't manage to do it the way I want to.

The problem is MIME encoded messages.
I've tried several approches, but I always get the same result: the Email
Content-type is always text/plain after I've sent it.
It seems like some of the header is stripped off.

Here is my code:

##########################################
...
use MIME::Parser;
use MIME::Entity;
use MIME::Head;

my $sCmd = "grepmail -iu -Y \'(\^From:)\' $sMyAddress $sPathToMailbox;
my @EmailLines = `$sCmd`;

my $oParser = new MIME::Parser;
my $oEmail = $oParser->parse_data(\@EmailLines);
$oEmail->head->replace("To", $sBounceAddress);

my $sRes = $oEmail->smtpsend;
...
##########################################

Does anyone have a suggestion on how I can forward the mail without
stripping the header?

Thanx in advance!

-Nils Magne Lunde

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.