http://www.perlmonks.org?node_id=827711

Appy16 has asked for the wisdom of the Perl Monks concerning the following question:

Hi.. I'm trying to send an email using the Script I've posted below. The script downloads a particular file and mails it as an attachment but has just one problem. The problem is that the email i am sending is sent into Spam or the Junk folder. How can i authenticate the mail using this script.
#!/usr/bin/perl use LWP::Simple; use MIME::Lite; use Spreadsheet::WriteExcel; $from = 'abc\@gmail.com'; $to = 'def\@gmail.com'; $Subject = 'Daily Social Media search'; my $url = "abc.org/?xyz=csv"; my $file = "/Users/abc/Desktop/abc.csv"; my $status = mirror($url,$file); die "Cannot retrieve $url" unless is_success($status); # Part using which the file being downloaded is sent as an attachment +to an email # $msg = MIME::Lite->new( From => $from, To => $to, Subject => $Subject, Type => 'multipart/Mixed', ); $msg->attach( Type => 'Text', Data => "The attachment contains the csv file downloaded t +oday." ); $msg->attach( Type => 'Application/Text', Path => "/Users/abc/Desktop/abc.csv" ); print "Mail Sent\n"; $msg->send; # send via default