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

Hey, I have changed your code accordingly but i am not able to send emails to any account

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

    Jenda has already suggested you learn how to debug code in one of the other threads you started on this same subject. Debuging is an essential skill if you work with code for a living.

    To do this effectively you need to be comfortable with the technologies you are using in order to resolve problems with minimal effort. If you don't take the time to learn the tools and technologies you are working with, you only make your task harder.

    Martin

      #!/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";

        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

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