in reply to problem with Mail::Sender while sending email

Ok, ignoring the fact you're posting a new question instead of on the old thread, and not using already working code I gave you as a base, there are a few problems here:

Update: Ok, the first two issues are resolved, but still, yes this code does successfully send inline html mail to outlook and thunderbird.

Replies are listed 'Best First'.
Re^2: problem with Mail::Sender while sending email
by chandanperl (Novice) on Aug 26, 2009 at 04:53 UTC
    Please check it. I have modified the code.
    #!/usr/bin/perl use Mail::Sender; open(FH,"file.txt"); my $var; while(<FH>) { $var .= $_; } close(FH); eval { Mail::Sender->new( {from => 'from@domain.com', smtp => 'smtp.server.com'}) ->OpenMultipart({ to => '', subject => 'Subject Here!', multipart => 'related', }) ->Part({ ctype => 'text/html', disposition => 'NONE', msg => <<'*END*' $var}) $var *END* ->Attach({ description => 'test file', ctype => 'application/octet-stream', encoding => 'base64', disposition => "attachment; filename= file1 ", file => 'file1' }) ->Close(); } or print "Error sending mail: $Mail::Sender::Error\n";
      Please check this code
      ->Part({ ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'}) $var *END*
        You don't need a heredoc when you have the text in a variable already.

        use this instead
        ->Part({ ctype => 'text/html', disposition => 'NONE', msg => $var})
        Look at this:
        $var = 'hello world'; print <<'END'; $var END
        and this
        $var = 'hello world'; print <<"END" $var END
        Assuming you really do want a 'heredoc' here, you want the second kind.

        Don't put stars in the heredoc terminator, that's ugly. If it doesn't stand out enough already, you need a different editor. END



        - Boldra