my $from_name = $mail_from; my $from_address = $display_name; my $to_address = $_; my $subject = 'Daily Report'; my $mime_type = 'TEXT'; my $message = "Your PDF report is attached."; # Create the initial text of the message my $mime_msg = MIME::Lite->new( From => $from_address, To => $to_address, Subject => $subject, Type => $mime_type, Data => $message ) or die "Error creating MIME body: $!\n"; my $filename = 'daily.pdf'; my $recommended_filename = 'daily.pdf'; # Attach the file $mime_msg->attach( Type => 'application/pdf', Path => $filename, Filename => $recommended_filename ) or die "Error attaching test file: $!\n";