in reply to Re^3: Mime::lite "no data" error again
in thread Mime::lite "no data" error again

Hi! I have strict on, the variables name is correct. When I set it to $text_mail= 'Testing'; just before inserting it in the msg, it doesn´t fail. I receive this variable from another function. I tried writing the same test-string in it there and then passed it to my "sendmail"-function. It failed again. I have one main function calling the buildText(), then passing 2 params to the sendMail() like shown in the code below.
buildText { #blabla return ($out, $text_mail ); } sendMail { my $p = { @_ }; my $body = $p->{body}; my $text_mail = $p->{text_mail}; #blabla } main_function { #blabla my ($body, $text_mail) = buildText(); return sendMail( body => $body, text_mail => $text_mail);

Replies are listed 'Best First'.
Re^5: Mime::lite "no data" error again
by jethro (Monsignor) on Dec 09, 2009 at 17:13 UTC

    There has to be something wrong with your variable $text_mail. Is the attach method you showed in your original post called in the sub sendMail? Or somewhere outside? It could be a scoping issue.

    Please insert the following in your program just before the attach and provide the result:

    use Data::Dumper; print Dumper(\$text_mail); $msg->attach( ...

    This will show exactly what is in $text_mail at the moment you call attach (it will even show hidden control characters should there be any)