hmbscully has asked for the wisdom of the Perl Monks concerning the following question:
Which worked great and would insert form variable values ($name in this example) into the email body. Now I'm trying to usesub send_email { open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n"; print MAIL "Content-type:text/html\n"; print MAIL "From: $from_email\n"; print MAIL "To: $to_email\n"; print MAIL "Subject: $attention Employment Application : $fields{'n +ame'}\n\n"; print MAIL <<to_the_end; <html> <head> <title>Human Resources : Application for Employment</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> </head> <body bgcolor="#FFFFFF" marginwidth="0" marginheight="0" class="margin +"> <table width="600" border="0"> <tr valign="top"> <td width="300"><font face="Arial, Helvetica, sans-serif" size="-1"><b +>Name:</b> <i>$name</i></font></td> </tr> </table> to_the_end close (MAIL); }
and instead of printing out the value of $name, it just prints $name literally. I've been reading all over the place and everything just points to using the $message variable for the email, but how do I build the $message variable with other variable values? Is there anything similar to the print <<to_the_end; functionality for MIME? TIAsub Email_Results{ my $message = ' <html> <head> <title>Human Resources : Application for Employment</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +"> </head> <body bgcolor="#FFFFFF" marginwidth="0" marginheight="0" class="margin +"> <table width="600" border="0"> <tr valign="top"> <td width="300"><font face="Arial, Helvetica, sans-serif" size="-1"><b +>Name:</b> <i>$name</i></font></td> </tr> </table> </body> </html>'; $msg = MIME::Lite->new(From => 'net-admin@someplace.org', To => 'decoraw@someplace.org', Subject => 'Trying to send attachment', Type => 'multipart/mixed'); $msg->attach(Type => 'text/html', Data => $message); $msg->attach(Type => 'application/octet-stream', Path => "$Directory/$File_Name", Filename => $File_Name ); $msg->send(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MIME::Lite $message construction with variables
by BUU (Prior) on Jun 10, 2004 at 22:09 UTC | |
by hmbscully (Scribe) on Jun 10, 2004 at 22:18 UTC | |
by Anonymous Monk on Aug 05, 2022 at 10:05 UTC | |
by Corion (Patriarch) on Aug 05, 2022 at 10:20 UTC | |
|
Re: MIME::Lite $message construction with variables
by Enlil (Parson) on Jun 10, 2004 at 21:59 UTC | |
by drewbie (Chaplain) on Jun 11, 2004 at 03:20 UTC | |
|
Re: MIME::Lite $message construction with variables
by hsinclai (Deacon) on Jun 10, 2004 at 21:34 UTC | |
by hmbscully (Scribe) on Jun 10, 2004 at 21:42 UTC | |
by hsinclai (Deacon) on Jun 10, 2004 at 21:49 UTC |