Hi,

I am having a "bang my head against the desk" moment!
I am trying to add text and html parts to a multipart/alternative message
but keep getting - "no data in this part" errors!

Here's the code:

            my $msg = MIME::Lite->new(
                From     =>$from,
                To       =>$tr,
                Subject  =>'My Subject',
                Type     =>'mutlipart/alternative'
            );

            foreach my $copy (qw(text html)) {
                if (exists $details->{copy}->{$copy}) {
                    print STDERR "FOUND $copy==========\n" .
Dumper($details->{copy}->{$copy}); # Finds both HTML and text parts
                    my $copy_out;

                    my $template = Template->new({
                            INCLUDE_PATH  => $conf->{template}->{lib},
                            OUTPUT        => \$copy_out
                    });
                    $template->process($details->{copy}->{$copy},
$em_details) || die "Template: ", $template->error();
                    print STDERR "Processes Copy==========" . $copy_out; #
Prints out processed parts correctly...
                    my $type = 'html';
                    if ($copy eq 'text') {
                        $type = 'plain';
                    }

                    $msg->attach(
                         Type => 'text/' . $type,
                         Data => $copy_out
                    );
                }
            }

            MIME::Lite->send('smtp', "192.168.1.9", Timeout=>60);
            $msg->send;

This code seems fine to me.... and I've done it a million times
Am I missing something completely stupid!!!!

TIA

Andy


Reply via email to