in reply to How do I send ONLY HTML mail using MIME::Lite::TT::HTML

I'd do it like this:
#!/usr/bin/perl use strict; use warnings; use MIME::Lite::TT::HTML; my %params; $params{firstname} = 'MyFirstName'; $params{lastname} = 'MyLastName'; my %options; $options{INCLUDE_PATH} = '/path/to/template'; my $msg = MIME::Lite::TT::HTML->new( From => 'email@domain.com', To => 'otheremail@otherdomain.com', Subject => 'Test 1', Timezone => 'UTC', Type => 'multipart/related', Encoding => 'base64', Template => { html => 'template.html', }, Charset => 'utf8', TmplOptions => \%options, TmplParams => \%params, ); $msg->attach( Type => 'text/html', Data => qq{ <body> Here is <i>my</i> image: <img src="cid:image.png"> </body> }, ); $msg->attach( Type => 'image/png', Path => '/path/to/image/image.png', Id => 'img1', ); $msg->send( 'smtp', 'smtp.somedomain.com', Debug => 1, Timeout => 60, );

Replies are listed 'Best First'.
Re^2: How do I send ONLY HTML mail using MIME::Lite::TT::HTML
by trebor (Initiate) on Mar 07, 2012 at 16:35 UTC
    Thanks. Will give that a try.

    I took a look at the module itself and I see that I could just get rid of the portion of the script that generates the text version of the email. Not the best solution I know.

    I have another problem relating to MIME::Lite::TT::HTML

    I am able to send email using MIME::Lite::TT::HTML from my web server to my domains on my email server, the servers are on separate physical boxes, but I am unable to send email from the web server to domains outside my network.

    For example MIME::Lite::TT::HTML will send email from my web server to myusername@mydomainname.com which is on my mail server but MIME::Lite::TT::HTML will not send mail from my web server to say someuser@gmail.com or anotherusername@aol.com

    Error from Logfile:

    Wed Mar 07 10:53:06 2012 error client abc.abc.abc.abc MIME::Lite::SMTP=GLOB(0x34bf960)>>> MAIL FROM:<getaninvite@somedomain.com>\r, referer: http://www.somedomain.com/invite.html
    Wed Mar 07 10:53:06 2012 error client abc.abc.abc.abc MIME::Lite::SMTP=GLOB(0x34bf960)<<< 250 2.1.0 Ok, referer: http://www.somedomain.com/invite.html
    Wed Mar 07 10:53:06 2012 error client abc.abc.abc.abc MIME::Lite::SMTP=GLOB(0x34bf960)>>> RCPT TO:<someuser@aim.com>\r, referer: http://www.somedomain.com/invite.html
    Wed Mar 07 10:53:07 2012 error client abc.abc.abc.abc MIME::Lite::SMTP=GLOB(0x34bf960)<<< 554 5.7.1 <someuser@aim.com>: Relay access denied, referer: http://www.somedomain.com/invite.html
    Wed Mar 07 10:53:07 2012 error client abc.abc.abc.abc SMTP recipient() command failed: , referer: http://www.somedomain.com/invite.html


    WEBSERVER < -----------> Router / Firewall <----------> Internet
                                                           |
                                                           |
    MAILSERVER <------------------>|


    I hope someone can point me to a quick fix so I can move on from here.

    Thanks again for your help.