Solved

Mail with HTML

Posted on 1998-11-04
6
248 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
[X]
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
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

739 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