TStanley has asked for the wisdom of the Perl Monks concerning the following question:

Oh gracious and all knowing monks:

Is it possible to use sendmail to send an attachment, or do I have to use one of the
CPAN modules to do this?

Here is what I have coded:

$rptname= "summary".$date.".txt"; print "Date: ", $date,"\n"; print "Report: ", $rptname,"\n"; ######################################################### #This will email the report open (sendmail, "|/usr/sbin/sendmail myname\@company.com"); $rptname; close(sendmail);
Any help given will be greatly appreciated.

TStanley

Replies are listed 'Best First'.
(chromatic) Re: Sending attachments with Sendmail
by chromatic (Archbishop) on Jul 20, 2000 at 04:03 UTC
    sendmail is just a Mail Transport agent. It doesn't know anything about attachments, it just moves a bunch of text from one place to another.

    Have a look at Mime::Lite on the CPAN. It can turn files ('attachments') into something your MTA can handle.

(jcwren) Re: Sending attachments with Sendmail
by jcwren (Prior) on Jul 20, 2000 at 02:07 UTC
    Why not use Net::SMTP or Mail::Mailer? It'll make your code more portable, and you can avoid the hassles of exec'ing external programs.

    While NT based, there's a whole discussion starting at node Sending mail on NT, that's applicable to what you're trying to do.

    --Chris

    e-mail jcwren
RE: Sending attachments with Sendmail
by Russ (Deacon) on Jul 21, 2000 at 02:46 UTC
Re: Sending attachments with Sendmail
by Aighearach (Initiate) on Jul 20, 2000 at 20:34 UTC