Reputation: 303
I am trying to send email using a Perl script from my Mac, for which I have installed MIME::Lite module. I am using a basic script to test:
#!/usr/bin/perl
use MIME::Lite;
$msg = MIME::Lite->new(
From =>"abc\@gmail.com",
To =>"xyz\@gmail.com",
Subject =>"Demo",
Data =>"Sent :-):-)"
);
$msg->send();
I have already set up my email account in my macbook. Please guide me if I need something else to check for as i am unable to send the email.
Upvotes: 0
Views: 1375
Reputation: 3631
I haven't used this module but I note the docs for it say
MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else. http://metacpan.org/pod/MIME::Lite
Having said that, you may need to do something like
Specify default send method:
MIME::Lite->send('smtp','some.host',Debug=>0); MIME::Lite->send('smtp','some.host', AuthUser=>$user, AuthPass=>$pass);
Upvotes: 0
Reputation: 11772
Gone are the days when you could just use a system call out to the command line:
mail [email protected] -s "I QUIT!" < body_of_message.txt
But if you install and configure mutt to talk to your mail server, you can do something pretty close:
mutt -s "I QUIT" [email protected] < body_of_message.txt
The hardest bit is configuring mutt, and that's not too bad. There are a ton of docs and howtos out there, like Mutt Configuration Doc ...or just google for "mutt configure" and the type of mail server that you're using; gmail, exchange, etc.
From there, in perl, you would just:
system("/path/to/mutt", "-s", "I QUIT", "boss\@megacorp.net", ...)
or die "Could not send Email";
Upvotes: 1