369 users online (1 members and 368 guests)  

  Results 1 to 2 of 2


  1. Replies: 5
  2. How to email a HTML url in Perl    Forum: CGI Perl Forum
    Replies: 0
  3. Replies: 1
  4. Replies: 0
  1. #1
    berkshire's Avatar
    New User

    Join Date
    Nov 2006

    Trying to create an html Email in Perl

    I have an existing shopping cart writting in perl where we Email a text message confirming the order. We want to change it to a html message confirmation. The problem I am having is that the html code is not being executed in the Email, but is displaying the code.
    Instead of getting :
    The code is being converted to:

    Therefore the shopper get html code instead of an executed html Email message. I don't know if I need to add flags to the sendmail (right now just -t), or I need to add a meta tag, or what. Help.

    The Email program we are starting with is Eudora Pro. We know that Eudora can do it, because our competitor send us a Email confirmation that did work, and the symbols < and > are not converted.

  2. #2
    ALL's Avatar
    Super Dooper Nerd

    Join Date
    Feb 2005

    Re: Trying to create an html Email in Perl

    time for some webstuff 101...

    every page has a mime type associated with it...

    for example... if you go to a page like:


    it prints the following headers...

    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Type: text/html; charset=UTF-8
    Content-Encoding: gzip
    Server: GWS/2.1
    Content-Length: 2034
    Date: Thu, 23 Nov 2006 06:12:42 GMT

    these headers tell the browser what it needs to know... the main thing you need to be looking at is:

    Content-Type: text/html;

    that header is the single most important thing to the browser, because it tells it that it needs to display the content as an html page... however... have you ever been to a site that is plain text? such as:


    this page outputs the following headers:

    HTTP/1.1 200 OK
    Content-Type: text/plain
    Last-Modified: Thu, 09 Nov 2006 22:49:53 GMT
    Content-Encoding: gzip
    Server: GWS/2.1
    Cache-Control: private, x-gzip-ok=""
    Content-Length: 616
    Date: Thu, 23 Nov 2006 06:17:51 GMT

    notice how it's content-type is different? and notice how the page is not displayed as an html page would be?

    in short emails act much the same way as webpages do...

    if you want to send a plain text mail the header:

    Content-Type: text/plain

    if you want to send an HTML email you need to send atleast:

    Content-Type: text/html

    but preferably:

    Content-Type: text/html; charset=UTF-8

    that should explain it...

    if you post your email section code i can help fix it up,

Tags for this Thread