
Cure
User
May 13, 2000, 11:51 AM
Post #6 of 6
(855 views)
|
Hi Use the Mime::lite module to hadnle your email attachemnts example this script will email the customer and you(you can change it how you want,its real easy) a form and a email picture. #!/usr/bin/perl use MIME::Lite; #Create a multipart message (i.e., one with attachments): # Create a new multipart message: $msg = new MIME::Lite From =>'me@myhost.com', To =>'you@yourhost.com', Cc =>'some@other.com, some@more.com', Subject =>'A message with 2 parts...', Type =>'multipart/mixed'; # Add parts (each "attach" has same arguments as "new"): attach $msg Type =>'TEXT', Data =>"Here's the GIF file you wanted"; attach $msg Type =>'image/gif', Path =>'logo.gif', Filename =>'logo.gif'; #Send a message: # Send in the "best" way (the default is to use "sendmail"): $msg->send; Or you can do it bye hand instead of using a module--< which is harder... Example (this will email you and whoever--> a cgi script(you can change it to whatever you want) sub sendmailcustomer { open(MAIL, "|/usr/sbin/sendmail -t") | | die "Can't open /usr/sbin/sendmail:$!"; print MAIL <<END_OF_MAIL; To: you\@texas.net CC: friend\@texas.net From: you\@texas.net Subject: This is a test Content-Type: multipart/mixed; boundary="My-Boundry" X-Mailer: guestbook.cgi Status: O --My-Boundry Content-type: text/html <html><body> <BIG><BIG><B>THIS IS CURE</BIG></BIG></B> </body></html> --My-Boundry Content-Type: text/plain; name="guestbook.cgi" Content-Disposition: attachment; filename="guestbook.cgi" END_OF_MAIL open FILE,"guestbook.cgi" or die "Could not open guestbook.cgi:$!"; select MAIL; while (<FILE> ) {print} close FILE; close MAIL; select STDOUT; } Cure [This message has been edited by Cure (edited 05-13-2000).]
|