Sending Attachment using MIME::Lite and Net::SMTP

Hello,

I'm a newbie perl scriptor and i'm trying to figure out why i can't send an email using MIME::Lite with Net::SMTP. I keep receiving the following error:

SMTP MAIL command failed:
5.7.1 Helo invalid .

at attach1.pl line 31

The error keeps coming from the very last line of my script. It seems like a syntax error but i'm stuck. The last line is:

$msg ->send();

Below is my script:

#!/usr/bin/perl -w
use warnings;
use MIME::Lite;
use Net::SMTP;
use strict;

my $msg = MIME::Lite->new(
From => 'elliot.anico@cellularatsea.com',
To => 'elliot.anico@cellularatsea.com',
cc => 'wms.nmc@cellularatsea.com',
Subject => 'Multiple attachments',
Type => 'multipart/mixed');

$msg->attach( Type =>'image/jpg',
Path =>'/export/home/omcadmin/bin/Sunset.jpg',
Filename =>'Sunset.jpg');

$msg->attach( Type =>'image/jpg',
Path =>'/export/home/omcadmin/bin/Winter.jpg',
Filename =>'Winter.jpg');

$msg->attach( Type =>'TEXT',
Data =>'This is a test for outside usage');

my $SMTP_SERVER = 'wmsexg01.corp.cellularatsea.com';

MIME::Lite->send('smtp', $SMTP_SERVER);
$msg ->send();

Can anybody assist me?

Try it without the image/jpg attachments. I see that you did not set the Disposition for these two attachments. This might be the problem.

I usually put a disposition in mine when I create emails, not sure if its required though:

$msg->attach(
	Type	=>'image/jpg',  
	Path 	=>'/export/home/omcadmin/bin/Sunset.jpg', 
	Filename =>'Sunset.jpg' 
        Disposition => 'attachment')
         or die "Failed: $!\n";

But not with TEXT

Another thing is try to remove the () from your send line:

msg->send();

Remove and use:

$msg->send;