Solved

Mail with HTML

Posted on 1998-11-04
6
219 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now