use warnings; use strict; use MIME::Lite; our $user = "username\@yahoo.in"; our $pass = "password"; our $attachmentname=$ARGV[0]; our $to = "username\@yahoo.in"; our $from = "username\@yahoo.in"; our $subject = "Hi buddy"; our $message = "Here is the attachment"; emailToSend($to, $from, $subject, $message); sub emailToSend { local ($to, $from, $subject, $message) = @_; my $msg = MIME::Lite->new( From => $from, To => $to, Subject => $subject, Data => $message ); $msg->attach(Type => 'image/gif', Id => 'GDIPlus_Image.gif', Path => 'images.zip', ); MIME::Lite->send('smtp', 'smtp.mail.yahoo.com:25', Timeout => 30, AuthUser=>$user, AuthPass=>$pass); $msg->send(); }