I'm using a formmail script to email generic messages using sendmail. Here are a few things I can't seem to figure out yet.
-Is there an 'easy' way to add a button to my email form that could attach a file from the client side? Just a text file.
-Rather than have the email body in the perl script, is there a way I could have the script pull the email body from another file?
Forgive me if these are too basic, I'm a novice w/ scripting.
Thanks in advance for any ideas.
-denver-Is there an 'easy' way to add a button to my email form that could attach a file from the client side? Just a text file.
Short answer is no.
-Rather than have the email body in the perl script, is there a way I could have the script pull the email body from another file?
Yes. Something along the lines of this simple example:
open(MAIL,"|$mailprog -t");
print MAIL "To: $recipient\n";
print MAIL "From: $sender\n";
print MAIL "Subject: $subject\n\n";
open (FILE, "<../filepath/filename") || die "Can't Open ../filepath/filename: $!\n";
@BODYOFEMAIL=<FILE>;
close(FILE);
foreach $line(@BODYOFEMAIL) {
print MAIL "$line";
}
close (MAIL);
Regards,
kevindenver,
Does this file that is being attached need to be uploaded to the server? Or emailed to an address?
Regards,kevin -
thanks for your reply. I'll be making changes and test out your suggestion. I think it should work out better if I don't have the body of the email in the perl script confusing me.
-----------
Jacob,
I'm hoping to find a way to have the file attachment come from the client, so it would have to be uploaded.
I've seen a few scripts around for file management that allow the client to upload to the server. I guess it'll just be a matter of trying to figure out how to put the two scripts together!
My box is getting upgrade from hp-ux 10.20 to 11.0 now. As soon as it's finished I've got a few things to load before testing my changes.
thanks!
-Is there an 'easy' way to add a button to my email form that could attach a file from the client side? Just a text file.
-Rather than have the email body in the perl script, is there a way I could have the script pull the email body from another file?
Forgive me if these are too basic, I'm a novice w/ scripting.
Thanks in advance for any ideas.
-denver-Is there an 'easy' way to add a button to my email form that could attach a file from the client side? Just a text file.
Short answer is no.
-Rather than have the email body in the perl script, is there a way I could have the script pull the email body from another file?
Yes. Something along the lines of this simple example:
open(MAIL,"|$mailprog -t");
print MAIL "To: $recipient\n";
print MAIL "From: $sender\n";
print MAIL "Subject: $subject\n\n";
open (FILE, "<../filepath/filename") || die "Can't Open ../filepath/filename: $!\n";
@BODYOFEMAIL=<FILE>;
close(FILE);
foreach $line(@BODYOFEMAIL) {
print MAIL "$line";
}
close (MAIL);
Regards,
kevindenver,
Does this file that is being attached need to be uploaded to the server? Or emailed to an address?
Regards,kevin -
thanks for your reply. I'll be making changes and test out your suggestion. I think it should work out better if I don't have the body of the email in the perl script confusing me.
-----------
Jacob,
I'm hoping to find a way to have the file attachment come from the client, so it would have to be uploaded.
I've seen a few scripts around for file management that allow the client to upload to the server. I guess it'll just be a matter of trying to figure out how to put the two scripts together!
My box is getting upgrade from hp-ux 10.20 to 11.0 now. As soon as it's finished I've got a few things to load before testing my changes.
thanks!