I have a short program that I want to email a simple text file as an attachment. I have gotten the email to work but not the attachment portion. Here is my code so far. Can someone help me with the attachment part. Thanks, Greg
$smtpserver= "server.com";
$mail{From} = 'Security Manager <sys_admin@Cargill.com>';
$mail{To} = '<gstark@'.$smtpserver.'>';
$mail{Smtp} = $smtpserver;
$mail{Subject} = "Accounts locked in the last 7 days";
$mail{Message} = "Please see attached file.\n";
$mail{attachment} = "$lock_File";
if (sendmail %mail) {
print "Email Successful";
}
else {
print "\n!Error sending mail:\n$Mail::Sendmail::error\n";
}
$smtpserver= "server.com";
$mail{From} = 'Security Manager <sys_admin@Cargill.com>';
$mail{To} = '<gstark@'.$smtpserver.'>';
$mail{Smtp} = $smtpserver;
$mail{Subject} = "Accounts locked in the last 7 days";
$mail{Message} = "Please see attached file.\n";
$mail{attachment} = "$lock_File";
if (sendmail %mail) {
print "Email Successful";
}
else {
print "\n!Error sending mail:\n$Mail::Sendmail::error\n";
}