58 users online (0 members and 58 guests)  


  Results 1 to 2 of 2

Related

  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

    Status
    Offline
    Join Date
    Nov 2006
    Posts
    2

    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 :
    <div><head><title>
    The code is being converted to:
    <div>&lt;head&gt;&lt;title&gt;

    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

    Status
    Offline
    Join Date
    Feb 2005
    Location
    localhost
    Posts
    382

    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:

    http://www.google.com

    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:

    http://www.google.com/robots.txt

    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,
    -ALL



Tags for this Thread