Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Mail with HTML

Posted on 1998-11-04
6
238 Views
Last Modified: 2010-03-04
I have the following script and it sends text mail just fine, but when I send html in the body and receive it with MS Outlook Express, it just gives html code.  When I receive it with eudora 4, it gives the actual pictures etc.  It is RFC 1521.

unless (open(SENDMAIL, ">$filename")){
print "Error opening email file.";
}
print SENDMAIL "Content-type: text/html\n\n";
print SENDMAIL "From: $from\n";
print SENDMAIL "To: $to\n";
print SENDMAIL "Subject: $subj\n";
print SENDMAIL "Date: $thedate\n";
print SENDMAIL "\n";
print SENDMAIL "$body\n";
close SENDMAIL;

What do I need to add or change to make the Outlook Express convert the html to actual pictures?  It must have something to do with content-type:.
0
Comment
Question by:Lee5
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:helver
ID: 1205939
Try removing the second newline from the Content-type print statement.
0
 

Author Comment

by:Lee5
ID: 1205940
That does not make any difference.
0
 
LVL 5

Expert Comment

by:b2pi
ID: 1205941
Any chance you're running the HTML on a Unix box?

Secondly, I don't see how you're sending mail (you're writing to a file $filename, but what processing are you doing after closing the file?)

0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:Lee5
ID: 1205942
Here is the entire script:

require "cgi-lib.pl";
require "ctime.pl";
&ReadParse(*input);
 $body = $input{'bod'};
 $from = $input{'email'};
 $to = $input{'to'};
 $subj = $input{'subj'};
 $thedate = &ctime(time);
print "Content-type: text/html\n\n";
 $filename = "C:\\exchsrvr\\imcdata\\Pickup\\uw$$.txt";
unless (open(SENDMAIL, ">$filename")){
 print "Error opening email file.";
}
print SENDMAIL "From: $from\n";
print SENDMAIL "To: $to\n";
print SENDMAIL "Subject: $subj\n";
print SENDMAIL "Date: $thedate\n";
print SENDMAIL "\n";
print SENDMAIL "$body\n";
close SENDMAIL;

$body is a html page.  If received in Eudora 4 the page shows up normally with all tables, pictures, etc.  In MS Outlook it shows only html code.
0
 

Author Comment

by:Lee5
ID: 1205943
It is on a NT box
0
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
ID: 1205944
What do you know.... there it is...

You're doing:

print "Content-type: text/html\n\n";
$filename = "C:\\exchsrvr\\imcdata\\Pickup\\uw$$.txt";
unless (open(SENDMAIL, ">$filename")){
    print "Error opening email file.";
}
print SENDMAIL "From: $from\n";

which print's the header to stdout (wherever that might be).  Instead, do


$filename = "C:\\exchsrvr\\imcdata\\Pickup\\uw$$.txt";
unless (open(SENDMAIL, ">$filename")){
    print "Error opening email file.";
}
print "Content-type: text/html\n\n";
print SENDMAIL "From: $from\n";


which will tell exchange that this really is html
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question