Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail text format when sending to MS Outlook 2

Status
Not open for further replies.

mrberry

MIS
Jun 15, 2004
80
US
I am using printf to consolidate overnight process reports into a single report which is then emailed from my Unix (AIX) host to reportees in MS Outlook mail.

When I view the text report file on the Unix side the formating is fine. When it arrives as the body of an email in Outlook the column spacing is jumbled.

I can change the font in my email so that it is readable, but I want to send this to others (managers) and they will not want to mess around with the email formatting.

Does anyone know how I can either:

a) Format the text before I send on the Unix side so it is readable when it gets to Outlook

b) Put some code in the text message that will cause Outlook to reformat the text or font when the mail is opened (this is the wrong formum for this question - but I am Unix guy and surely someone else has come across this problem before).

Any help is appreciated.

Thanks,

Mark
 
Send an html page with the minimum of tags, enclosing your report between <PRE> and </PRE>

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV, thank you for your reply.

From what you describe I assume my text file to be emailed should look like this?:

<PRE>

Report text

</PRE>



I tried this, but the email recieved in Outlook looks just like the literal file printing the <PRE> and </PRE> as text instead of formatting the text.

Is what am doing correct or am I missing something?

Thanks,

Mark
 
I didn't write some email-program myself, but shouldn't there be a
mime-type: text/html
somewhere in the header?
And perhaps a
Code:
<html>
something
<pre>
Report text
</pre>
maybe more
</html>

seeking a job as java-programmer in Berlin:
 
Try this:
<HTML><BODY><PRE>
Report text
</PRE></BODY></HTML>

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Stefan/PHV, thank you for your reply.

I tried both of these and it still displays literal text of the HTLM tags.

Thanks,

Mark
 
actually I don't know if you are attaching the report text file in the e-mail you are sending.if not try attaching the file instead of sending just the text included body of the message.

if you already tried that,
then, once you are done putting all the html tags as PHV mentioned, you might want to rename the file that you are attaching to something like ReportText.html
 
In order to get Outlook to properly interpret the HTML you need to include the HTML as a mime attachement with the proper encoding tag.
 
meetramana, thank you for your reply. I am using the command:

mailx -s "reports" mailaddress@mailserver.com < file.txt

I tried renaming the file to .html but Outlook still displays the tags as literal.


Eric, thank you for your reply. I am not very experienced with HTML, can you please give an example of how to create a MIME attachment and the tags required?

Thank you,

Mark
 
You may try to play with uuencode.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
You need a header that looks like this:
Code:
Content-Type: multipart/alternative;
	boundary="=_8fab488f99d4cb01e105e85dd0f0615f"
The boundary is just a unique string, the library I wrote uses the md5 hash of the attachment, very small probability of a collision.

Then in your message body:
Code:
--=_8fab488f99d4cb01e105e85dd0f0615f
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

a Text Version of your thing, if appropriate or a message to indicate that you need HTML enabled.

--=_8fab488f99d4cb01e105e85dd0f0615f
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<h2>then put hte HTML version of the message</h2>

--=_8fab488f99d4cb01e105e85dd0f0615f--

How did I figure this out? First I read the documentation: then I sent myself an email and dissected it in a text editor.
 
Try...
Code:
#!/usr/bin/ksh

export MAILTO="spam@ebay.com"
export CONTENT="/tmp/report.txt"
export SUBJECT="Overnight Report"
(
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 echo "<HTML><BODY><PRE>"
 cat $CONTENT
 echo "</PRE></BODY></HTML>"
) | /usr/sbin/sendmail $MAILTO
 
Ygor, thank you for your reply.

That works like a charm.

Thanks,

Mark.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top