I've been googling and reading for what seems like forever, but I haven't found anything that's helped me with my problem.
I'm not even sure if this is the right forum for this problem, but it's an email-related problem, so here goes . . .
We're on RH Linux 9. We've got sendmail 8.12.8 and we're using MIME::Lite 3.01 to send emails with attachments from perl scripts.
We've been having scripts look up info from an Oracle database and then build a csv file, attach it to an email, and send it. We've been doing this for a long time without problems, and this still works.
What we're trying to do now is retrieve a file stored in a database as a BLOB, save it as a local file, and then send it as an email attachment. This is where we are having problems.
The query to retrieve the file works fine as well as writing it to a local file. We are able to open the files (.doc, .xls, .csv, .tif, etc) through samba and we can send them as attachments using pine and they work.
But if we use the script to send them using MIME::Lite, the emails go and the attachments are there, they maintain their attributes (filename, size, date), but they can't be opened.
After a lot of experimenting, it seems that the perl script will not successfully send anything that was not created on the local machine. Text, csv, etc that were created on the machine either in vi or by a script can be attached and they work. But any file created through samba or the ones retrieved from the database fail.
We can even attach working (locally created) and non-working files to the same email.
Here's the code that sends the email:
Any help on this will be greatly apprciated.
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
I'm not even sure if this is the right forum for this problem, but it's an email-related problem, so here goes . . .
We're on RH Linux 9. We've got sendmail 8.12.8 and we're using MIME::Lite 3.01 to send emails with attachments from perl scripts.
We've been having scripts look up info from an Oracle database and then build a csv file, attach it to an email, and send it. We've been doing this for a long time without problems, and this still works.
What we're trying to do now is retrieve a file stored in a database as a BLOB, save it as a local file, and then send it as an email attachment. This is where we are having problems.
The query to retrieve the file works fine as well as writing it to a local file. We are able to open the files (.doc, .xls, .csv, .tif, etc) through samba and we can send them as attachments using pine and they work.
But if we use the script to send them using MIME::Lite, the emails go and the attachments are there, they maintain their attributes (filename, size, date), but they can't be opened.
After a lot of experimenting, it seems that the perl script will not successfully send anything that was not created on the local machine. Text, csv, etc that were created on the machine either in vi or by a script can be attached and they work. But any file created through samba or the ones retrieved from the database fail.
We can even attach working (locally created) and non-working files to the same email.
Here's the code that sends the email:
Code:
$msg = MIME::Lite->new(
From => $From,
To => $To,
Cc => $CC,
Subject => $Sub,
Bcc => $BCC,
Type => 'multipart/mixed');
#Attach Body of the email
$msg->attach(
Type => $BodyType,
Data => $Body);
# Add attachent(s) to the email
@Attachments=split(',',$Attachments);
foreach $AttPath(@Attachments){
# print "Attachment: $AttPath\n";
#Split the path/filename to get the filename
@array_path=split(/\//,$AttPath);
$AttFN=pop(@array_path);
$msg->attach(
Type => '',
Path =>$AttPath,
Filename=>$AttFN);
} #end of attachment add
# print "Attachment added\n";
#Send the email
$msg->send('sendmail', SetSender=>1);
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!