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

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; }

Replies are listed 'Best First'.
Re^5: MIME::Lite Error
by fishmonger (Chaplain) on Aug 21, 2014 at 13:48 UTC

    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.

Re^5: MIME::Lite Error
by marto (Cardinal) on Aug 21, 2014 at 12:01 UTC

    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?

Re^5: MIME::Lite Error
by clueless newbie (Curate) on Aug 21, 2014 at 13:28 UTC
    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) = @_;