stevetrans140
Programmer
How do I attach files using sendmail?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
# uuencode attachment to go with email
my $output_file = './templates/'.$session.'.txt';
`unix2dos $input_file | uuencode info.txt >$output_file`;
# grab output_file as attachment to send with email
my $mail_buffer;
open(MDR,"<$output_file") or showError("Failed to open MDR, $!");
while (<MDR>) { $mail_buffer .= $_; }
close MDR;
open (MAIL, "|$sendmail -f NADA $recipient") || showError("Can't open $mail_prog!, $!");
print MAIL "From: $recipient\n";
print MAIL "Reply-To: $recipient\n";
print MAIL "Errors-to: $recipient\n";
print MAIL "Subject: New Metadata Record\n";
print MAIL "Precedence: bulk\n\n";
print MAIL "-----------------------------------------------------------\n";
print MAIL "Your information is attached.\n";
print MAIL "$mail_buffer\n";
close (MAIL);