my $subject="Monthly Report"; my $file_link="\n Dear Customer: Please click on the link below to download the Monthly Report for the month of 2019-05.

Download Report \n\n"; # $fileloc contains the path of the stored file in our server. &SendEmail($from,$toAddress,$cc,$bcc,$subject,'text/html',$file_link,$from); # This module sends an email with link - by clicking will download the excel report. In the "download_report" script: if ($file =~ /\.xlsx$/) { print "Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\n"; # The Content-Disposition will generate a prompt to save the file. print "Content-Disposition: attachment; filename=$file\n"; print "\n"; &download ($fileloc); exit 0; # NEWLY ADDED DUE TO ISSUE IN EXCEL REPORT OPENING } print "Content-Type: text/html\r\n\r\n"; my $cgi = new CGI; print $cgi->redirect("tent"); print "The redirect seems to have failed."; die;