Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: MIME::Lite Error

by marto (Cardinal)
on Aug 21, 2014 at 11:17 UTC ( [id://1098221]=note: print w/replies, xml ) Need Help??


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

Your post was not offensive. Unless I very much misunderstand you, you are saying that you have a script which uses MIME::Lite to send your email contents, either the content you pass to MIME::Lite already has the things you want to get rid of, or MIME::Lite is adding arbitrary HTML, which I find hard to believe.

Two debugging options, ensure you understand the message content you pass to MIME::Lite (is your data what you think it is?) or debug MIME::Lite. Either way, your post still gives us nothing to go on.

Tutorials->Debugging and Optimization->Basic debugging checklist, brian's Guide to Solving Any Perl Problem and so on.

Replies are listed 'Best First'.
Re^4: MIME::Lite Error
by Badriperl (Initiate) on Aug 21, 2014 at 11:42 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) = @_;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1098221]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-24 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found