Solved

Mail with HTML

Posted on 1998-11-04
6
204 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

11 Experts available now in Live!

Get 1:1 Help Now