my $msg = MIME::Lite->new( From => $from, To => $to, Type => 'multipart/alternative', Subject => $subject_val, ); #### my $msg = MIME::Lite->new( Type => 'multipart/alternative', Subject => $subject_val, ); #### my $msg = MIME::Lite->new( Type => 'multipart/alternative', Subject => $subject_val, ); my $att_text = MIME::Lite->new( Type => 'text', Data => "plain text version", Encoding => 'quoted-printable', ); $att_text->attr('content-type' => 'text/plain; charset=UTF-8'); $msg->attach($att_text); my $att_html = MIME::Lite->new( Type => 'text', Data => "html version goo", Encoding => 'quoted-printable', ); $att_html->attr('content-type' => 'text/html; charset=UTF-8'); $msg->attach($att_html); my $email = $msg->as_string(); use Net::SMTP; my $smtp = Net::SMTP->new('smtp.gmail.com', Hello => 'domain.net', Timeout => 30, Debug => 1, SSL => 1 ) || die "Error: $!"; $smtp->auth($CFG->{db_smtp_user}, $CFG->{db_smtp_pass}) or die "Could not authenticate with mail.\n"; $smtp->mail('you@gmail.com'); # from addr $smtp->to('foo@bar.com'); $smtp->data(); $smtp->datasend($email); $smtp->quit();