I have a perl script that creates an email attachment file from POST data on a web page. This works just fine. I want to customize the email body to contain all of the text data from the file itself. I thought this would be just a matter of using the $smtp->datasend($POST values) with the $values coming from the names on the web page posting the data. Can someone show me what the correct code snippet would be? Here is my code:
[code=perl]
$smtp->mail( $from_email );
$smtp->to( $EmailRecipient , { SkipBad => 1 } );
#~ $smtp->reset();
$smtp->data();
$smtp->datasend('To : ');
$smtp->datasend( $EmailRecipient );
$smtp->datasend("\n") ;
$smtp->datasend("Subj ect: GTS Web Inquiry in MTI Format\n");
$smtp->datasend("MI ME-Version: 1.0\n");
$smtp->datasend('Cont ent-Type: multipart/mixed; boundary="--
=_NextPart_000_ 0018_01C0EA94.C F948390"' . "\n");
$smtp->datasend("\n") ;
$smtp->datasend("\n") ;
$smtp->datasend("Th is is a multi-part message in MIME format.\n");
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390\n");
$smtp->datasend("Cont ent-Type: text/plain\n");
$smtp->datasend("Cont ent-Transfer-Encoding: 7bit\n");
$smtp->datasend("\n") ;
$smtp->datasend("Impo rt the attachment into Maximizer.\n");
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390\n");
$smtp->datasend('Cont ent-Type: application/octet-stream; name="'. $attachfilename .'"' .
"\n");
$smtp->datasend("Cont ent-Transfer-Encoding: base64\n");
$smtp->datasend("Cont ent-Disposition: attachment; filename=" . $attachfilename . "\n");
$smtp->datasend("\n") ;
$smtp->datasend( $mtifile );
$smtp->datasend("\n") ;
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390--\n");
$smtp->dataend();
[/code]
Here is what a selected portion of the html code looks like that is posted:
[code=html]
<INPUT TYPE="hidden" name="field_lab el_U_Gender_Lis t" value="Seminary \Gender_List">
<INPUT TYPE="hidden" name="field_nam e_U_Gender_List " value="Seminary \Gender_List">
<INPUT TYPE="hidden" name="field_req uired_U_Gender_ List" value="1">
<INPUT TYPE="hidden" name="field_max length_U_Gender _List" value="1">
<INPUT TYPE="hidden" name="field_typ e_U_Gender_List " value="0">
<SELECT name="field_dat a_U_Gender_List " size="1" >
<OPTION>Femal e</OPTION>
<OPTION>Male</OPTION>
</SELECT>
[/code]
Thanks!
Jim
[code=perl]
$smtp->mail( $from_email );
$smtp->to( $EmailRecipient , { SkipBad => 1 } );
#~ $smtp->reset();
$smtp->data();
$smtp->datasend('To : ');
$smtp->datasend( $EmailRecipient );
$smtp->datasend("\n") ;
$smtp->datasend("Subj ect: GTS Web Inquiry in MTI Format\n");
$smtp->datasend("MI ME-Version: 1.0\n");
$smtp->datasend('Cont ent-Type: multipart/mixed; boundary="--
=_NextPart_000_ 0018_01C0EA94.C F948390"' . "\n");
$smtp->datasend("\n") ;
$smtp->datasend("\n") ;
$smtp->datasend("Th is is a multi-part message in MIME format.\n");
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390\n");
$smtp->datasend("Cont ent-Type: text/plain\n");
$smtp->datasend("Cont ent-Transfer-Encoding: 7bit\n");
$smtp->datasend("\n") ;
$smtp->datasend("Impo rt the attachment into Maximizer.\n");
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390\n");
$smtp->datasend('Cont ent-Type: application/octet-stream; name="'. $attachfilename .'"' .
"\n");
$smtp->datasend("Cont ent-Transfer-Encoding: base64\n");
$smtp->datasend("Cont ent-Disposition: attachment; filename=" . $attachfilename . "\n");
$smtp->datasend("\n") ;
$smtp->datasend( $mtifile );
$smtp->datasend("\n") ;
$smtp->datasend("\n") ;
$smtp->datasend("----=_NextPart_000_ 0018_01C0EA94.C F948390--\n");
$smtp->dataend();
[/code]
Here is what a selected portion of the html code looks like that is posted:
[code=html]
<INPUT TYPE="hidden" name="field_lab el_U_Gender_Lis t" value="Seminary \Gender_List">
<INPUT TYPE="hidden" name="field_nam e_U_Gender_List " value="Seminary \Gender_List">
<INPUT TYPE="hidden" name="field_req uired_U_Gender_ List" value="1">
<INPUT TYPE="hidden" name="field_max length_U_Gender _List" value="1">
<INPUT TYPE="hidden" name="field_typ e_U_Gender_List " value="0">
<SELECT name="field_dat a_U_Gender_List " size="1" >
<OPTION>Femal e</OPTION>
<OPTION>Male</OPTION>
</SELECT>
[/code]
Thanks!
Jim
Comment