B
blaine
Hello,
I'm trying to send a message that has an attachment as well as either
text or html message depending on the email client. Below is the code
I use to create the structure. However when the email arrives it looks
good except that boundary information is displayed prior to the email
client showing the correct alternative selection.
How can I manipulate this structure so that boundary information is
not displayed when the email client chooses either the text or html
entity for display?
++++CODE++++
my $top = MIME::Entity->build('Type' => "multipart/mixed",
'From' => '(e-mail address removed)',
'To' => '(e-mail address removed)',
'Subject' => 'test Message' );
### Attach stuff to it:
$top->attach(Path => "t.txt",
Type => "text/plain",
Disposition => "attachment",
Encoding => "7bit");
##Build Alternative Entity for email client to select the correct
message
my $ent = MIME::Entity->build('Type' => "multipart/alternative");
$ent->attach(Data => 'test text/plain Message',
Type => 'text/plain',
Encoding => "7bit");
$ent->attach(Data => '<html><body>test <h3>text/html</h3> Message</
body></html>',
Type => 'text/html',
Encoding => "7bit");
## add the alternitive entity to the root entity (multipart/mixed)
$top->add_part( $ent );
## Show the skeleton.. After send the message
$top->dump_skeleton(\*STDERR);
#open MAIL, "| /usr/sbin/sendmail -t -f \"(e-mail address removed)\"" or die
"open: $ !";
#$top->print(\*MAIL);
#close MAIL;
I'm trying to send a message that has an attachment as well as either
text or html message depending on the email client. Below is the code
I use to create the structure. However when the email arrives it looks
good except that boundary information is displayed prior to the email
client showing the correct alternative selection.
How can I manipulate this structure so that boundary information is
not displayed when the email client chooses either the text or html
entity for display?
++++CODE++++
my $top = MIME::Entity->build('Type' => "multipart/mixed",
'From' => '(e-mail address removed)',
'To' => '(e-mail address removed)',
'Subject' => 'test Message' );
### Attach stuff to it:
$top->attach(Path => "t.txt",
Type => "text/plain",
Disposition => "attachment",
Encoding => "7bit");
##Build Alternative Entity for email client to select the correct
message
my $ent = MIME::Entity->build('Type' => "multipart/alternative");
$ent->attach(Data => 'test text/plain Message',
Type => 'text/plain',
Encoding => "7bit");
$ent->attach(Data => '<html><body>test <h3>text/html</h3> Message</
body></html>',
Type => 'text/html',
Encoding => "7bit");
## add the alternitive entity to the root entity (multipart/mixed)
$top->add_part( $ent );
## Show the skeleton.. After send the message
$top->dump_skeleton(\*STDERR);
#open MAIL, "| /usr/sbin/sendmail -t -f \"(e-mail address removed)\"" or die
"open: $ !";
#$top->print(\*MAIL);
#close MAIL;