+ my @mimeparts = (ref($options{'mimeparts'}) eq 'ARRAY')
+ ? @{$options{'mimeparts'}} : ();
+ my $mimetype = (scalar(@mimeparts)) ? 'multipart/mixed' : 'text/plain';
+
+ my @mimeargs;
+ if (scalar(@mimeparts)) {
+ @mimeargs = (
+ 'Type' => 'multipart/mixed',
+ );
+
+ push @mimeparts,
+ {
+ 'Data' => $options{'body'},
+ 'Disposition' => 'inline',
+ 'Type' => (($options{'content-type'} ne '')
+ ? $options{'content-type'} : 'text/plain'),
+ };
+ } else {
+ @mimeargs = (
+ 'Type' => (($options{'content-type'} ne '')
+ ? $options{'content-type'} : 'text/plain'),
+ 'Data' => $options{'body'},
+ );
+ }
+
+ my $message = MIME::Entity->build(
+ 'From' => $options{'from'},
+ 'To' => $to,
+ 'Sender' => $options{'from'},
+ 'Reply-To' => $options{'from'},
+ 'Date' => time2str("%a, %d %b %Y %X %z", time),
+ 'Subject' => $options{'subject'},
+ @mimeargs,