Philip wrote:
> On 19 Jun 2002, Kanti Jadia wrote:
>
> > I want to send a file as attachment every few hours (using cron)
> >
> > The file is a binary file and merely appending(using mail command)
> > does not suffice.
>
> First, add this header to the message:
>
> Content-type: multipart/mixed; boundary="some_string_of_text"
> MIME-Version: 1.0
....
>
> I could send you a program that does this, but I'm feeling too lazy
> right now.
Why write a new program for such a simple task? Why not use
Mail::Sender? Here is a simple script -
------------------------------------------------
#!/usr/bin/perl
use Mail::Sender;
if (!($ARGV[0])) {
print "\n\tUsage: $0 <attachfilename> \n\n";
exit;
}
$file_name = $ARGV[0];
$smtp_server = 'your.smtp.server';
$sender_mail = 'You<you@domain>';
$recipients = 'YourRecipient<recipient@domain>';
$mail_subject = 'Checkout the Attached File';
$msg_body = "\n\n Checkout the attachment";
$sender = new Mail::Sender { smtp => $smtp_server ,
from => $sender_mail
};
$sender->MailFile(
{to => $recipients,
subject => $mail_subject,
msg => $msg_body,
file => $file_name });
$sender->Close;
------------------------------------------------
Regards,
Nilesh C.
________________________________________________________________________
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!!
visit http://in.autos.yahoo.com
_______________________________________________
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers