471,092 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

Bounce Email

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
1 3516
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.

Similar topics

reply views Thread by Alan Kennedy | last post: by
7 posts views Thread by VK | last post: by
2 posts views Thread by Justin | last post: by
4 posts views Thread by Bloon | last post: by
2 posts views Thread by Arjen | last post: by
3 posts views Thread by Darren Clark | last post: by
2 posts views Thread by Phlip | last post: by
3 posts views Thread by aj | last post: by
18 posts views Thread by Grant Edwards | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.