Lunarpages Web Hosting Forum

Author Topic: TFmail: creating formatted email  (Read 8657 times)

Offline audreyvif

  • Newbie
  • *
  • Posts: 3
TFmail: creating formatted email
« on: June 21, 2007, 02:38:23 PM »

I'm a near-newbie, since my perl skills are too rusty to count.

I need to generate HTML-formatted email from a tfmail script.  That is, when I first read up on tfmail, I chose it because it promised HTML-formatted output.

However, now that I've gotten it working and generating the default email format, I'm not finding anything in the README about formatting the generated email with HTML - only the success (or failure) pages.

Does anyone know how to mix HTML in the email template file?

Thank you very much!

Offline audreyvif

  • Newbie
  • *
  • Posts: 3
Re: TFmail: creating formatted email
« Reply #1 on: June 21, 2007, 02:47:58 PM »
Hello again all,

I just found a previous post on this topic, where the suggestion was to try inserting the following in the email.trt file, which I tried and unfortunately merely causes the literal HTML to be sent:
%% NMS email template file %%
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
Below is the result of your feedback form.  It was submitted by {= by_submitter =}on {= date =}<br>
{= FOREACH input_field =}
<b>{= name =}:</b> {= value =}<br>
{= END =}

Anyone else have an idea?


Offline wtovey

  • Newbie
  • *
  • Posts: 3
Re: TFmail: creating formatted email
« Reply #2 on: February 28, 2011, 08:37:24 PM »
I realize this is a very old post, but I'm hoping the reply will help some future Google searcher ... 

To make the html email work, you have to edit your main file.  Scroll down to line 868 or so, and you'll find this:

      my $ml = MIME::Lite->new(
         To               => $msg->{To},
         From             => $msg->{From},
         Subject          => $msg->{Subject},
         'X-Http-Client'  => $x_remote,
         'X-Generated-By' => $x_gen_by,
         Type             => 'text/plain; charset=' . CHARSET,
         Data             => $msg->{body},
         Date             => '',
         Encoding         => 'quoted-printable',

  Type             => 'text/plain; is your problem -- you're declaring plain text.  For html email to work, you have to change the declaration to     Type             => 'text/html;  That'll do it.