in reply to Re: MIME::Lite Error
in thread MIME::Lite Error

Hi Marto, Thank you for the reply. I am not saying MIME::Lite is adding it. Sorry if my post was offensive, all my question was I am getting those unwanted characters, how do I remove it? I am using MIME:Lite for sending mails was just for the information.

Replies are listed 'Best First'.
Re^3: MIME::Lite Error
by marto (Cardinal) on Aug 21, 2014 at 11:17 UTC

      Hi Marto, This is the code snippet, I am sure that the data which I am attaching doesn't have HTML tags or something unwanted. It could be something wrong with the parser or encoding/decoding.

      sub mail { my ($msg); my ($receiver, $ccList, $sender, $replyTo, $subject, $body) = @_; $subject || die "Error: subject Not Defined $!\n"; $receiver || die "Error: receiver Not Defined $!\n"; $ccList || die "Error: CC List Not Defined $!\n"; $sender || die "Error: sender Not Defined $!\n"; $replyTo || die "Error: replyTo Not Defined $!\n"; $body || die "Error: body Not Defined $!\n"; $msg = MIME::Lite->new( To => $receiver, From => $sender, "Reply-To" => $replyTo, cc => $ccList, Subject => $subject, Type => 'multipart/related' ) or die "Error creating multipart container: $!\n"; $msg->attach( Type => 'text/html', Data => qq{ <body> @$body </body> }, ); $msg->send; }

        Dump $body to see what it holds.

        use Data::Dumper; # put this with your other use statements my ($receiver, $ccList, $sender, $replyTo, $subject, $body) = @_; print Dumper $body;

        If you see the offending line, then you know you need to look into where the data passed to the sub for $body is coming from and fix/remove it from there.

        You claim that the following is being added:

        < td bgcolor="lightgreen">

        Look at the source of MIME::Lite, do you find anywhere that adds the tag above?

        Maybe change
        my ($msg); my ($receiver, $ccList, $sender, $replyTo, $subject, $body) = @_;
        to
        my ($msg); for (@_) { print "\n",$_,"\n" if (m{lightgreen}); }; my ($receiver, $ccList, $sender, $replyTo, $subject, $body) = @_;