in reply to Re^4: EMail problem in outlook
in thread EMail problem in outlook

#!/usr/bin/perl use MIME::Lite; use Mail::Sender; open(FH,"file.txt"); while(<FH>) { $var = $_; print "$var\n"; } close(FH); eval { Mail::Sender->new( {from => '', smtp => ''}) ->OpenMultipart({ to => '', subject => 'Subject Here!', multipart => 'related', }) ->Part({ ctype => 'text/html', disposition => 'NONE', msg => $var}) ->Close(); } or print "Error sending mail: $Mail::Sender::Error\n";

Replies are listed 'Best First'.
Re^6: EMail problem in outlook
by marto (Cardinal) on Aug 25, 2009 at 14:47 UTC

    This code comes with no explanation, error message or commentary at all. You import Mime:Lite but never use it. What is the purpose of this post? Was there something I said previously which has caused confusion?

    Thanks

    Martin

Re^6: EMail problem in outlook
by james2vegas (Chaplain) on Aug 25, 2009 at 14:44 UTC
    In this part of your code
    open(FH,"file.txt"); while(<FH>) { $var = $_; print "$var\n"; } close(FH);
    $var will only be set to the very last line of your file, not the whole file.
    Replace $var = $_; with $var .= $_; so that it contains the whole file. Also add a line like my $var; before the while (<FH>) line.
    Those lines should look like this:
    open(FH,"file.txt"); my $var; while(<FH>) { $var .= $_; } close(FH);