http://www.perlmonks.org?node_id=999075


in reply to Perl Email attchment using Sendmail with out nay perl Modules like (MIME::Lite .etc )

Hi

If you want to build a mail with attachment you have to build a valid MIME-message. That is not trivial. That's why there are so many big packages at CPAN. But if you really have the need, than I would suggest to look at the cli tool mail of your OS. The newer versions are able to handle attachments.

So my proposal:

my $rc = system("echo '' | mail -s 'Test' -a $file $to");

Best regards
McA

  • Comment on Re: Perl Email attchment using Sendmail with out nay perl Modules like (MIME::Lite .etc )
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Perl Email attchment using Sendmail with out nay perl Modules like (MIME::Lite .etc )
by ppnair (Initiate) on Oct 15, 2012 at 12:29 UTC

    Thank you

Re^2: Perl Email attchment using Sendmail with out nay perl Modules like (MIME::Lite .etc )
by ppnair (Initiate) on Oct 16, 2012 at 12:03 UTC

    Getting below error when i try mail command

    mail: invalid option -- a Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr .. +. [-- sendmail-options ...] mail [-iInNv] -f [name] mail [-iInNv] [-u user]

      That's the reason I wrote: ... the newer versions ...

      So, in this special case you're out of luck. Is there a reason you can't install MIME::Lite as suggested by another monk here?

      Best regards
      McA