in reply to How to send mail containing multiple lines using Mail::Mailer?

The code attached works for me and if it works for you then you've got other issues (mail server, environment, bad luck) ;-) One quick comment about the code snippet you posted - you're mixing camelCase ($mailContents) with underscore_case ($mail_headers). My advice is to pick one, and make sure you 'use warnings' at the top of you code.

One thing to _maybe_ try is using '\r\n' or just '\r'. Maybe your mailserver is wonky. :)

KPH
use strict; use warnings; use Mail::Mailer; my $mailer = new Mail::Mailer 'smtp', Server => 'localhost' or die "Co +uldn't create a mail object!\n"; my $mail_content = "Here is a first line.\nHere is a second line.\n"; my $mail_header = { 'Content-Type' => 'text/plain', To => [ 'xxxxxxxxxxxxxxxxxxxxxxx' ], From => 'xxxxxxxxxxxxxxxxxxxxxxx', Subject => 'Just some subject.', }; $mailer->open( $mail_header ); $mailer->print($mail_content); $mailer->close();
  • Comment on Re: How to send mail containing multiple lines using Mail::Mailer?
  • Download Code