Welcome to WebmasterWorld Guest from 54.167.252.62

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

how to send attachment by mail using perl script?

     
12:26 am on Feb 27, 2004 (gmt 0)

10+ Year Member



hi

how to send an attachment by mail using a perl script?
if someone can post a script, I'll be very happy.

kind regards
cccc

9:41 pm on Feb 27, 2004 (gmt 0)

10+ Year Member




$mailer = MIME::Lite->new(From=>'',
To=>'',
Subject=>'',
Type=>'multipart/mixed');
$mailer->attach( Type=>'text/html',
Data=> $yourmessage);
$mailer->attach(Type=>"application/xls",
Path=>'',
Filename=>'',
Dispostion=>'attachment');
$mailer->send('smtp', $yoursmtpserver);
12:24 am on Mar 1, 2004 (gmt 0)

10+ Year Member



hi flashfan

I tried but I get compilation errors.

#!/usr/bin/perl -w

use strict;
use warnings;
use MIME::Lite;

#MIME::Lite->send("sendmail", "/usr/sbin/sendmail -t -oi -oem");

$yoursmtpserver = "/usr/sbin/sendmail"

$mailer = MIME::Lite->new(From=>'root@mydomain.com',
To=>'postmaster@mydomain.com',
Subject=>'Hi',
Type=>'multipart/mixed');
$mailer->attach( Type=>'text/html',
Data=> $yourmessage);
$mailer->attach(Type=>"application/xls",
Path=>'/var/log.txt',
Filename=>'log.txt',
Dispostion=>'attachment');
$mailer->send('sendmail', $yoursmtpserver);

greetings
cccc

2:06 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



Be sure you have MIME::Lite module installed.
9:29 pm on Mar 3, 2004 (gmt 0)

10+ Year Member



hi flashfan

MIME::Lite is installed.

kind regards
cccc

 

Featured Threads

Hot Threads This Week

Hot Threads This Month