Visit Our UNIX and Linux User Community


email from *nix to Exchange - text formatting issue

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions email from *nix to Exchange - text formatting issue
# 1  
Old 08-23-2012
email from *nix to Exchange - text formatting issue

Oracle Linux 5.6 x-86-64 (Red Hat derivitive)

I have several shell scripts that capture output to a log file, then use that log file as the source of an email. For a very simplified example:

Code:
 
echo Today is `date` >> $logfile
/bin/mail -s "$subject" "$sendto" < $logfile

(yes, $subject and $sendto are also set)

Mail from the linux server is aliased and redirected to my Outlook account on the Exchange server.

Problem is that some of the lines get wrapped in the email. I've examined the log file with a hex editor and found that the x'0D' terminators are all exactly where they should be, but some lines are still wrapped in the body of the email. And it's not consistent. For example, if the log file has this:

Code:
 
abc
def
ghi
jkl
mno
pqr

The email may show

Code:
 
abc def ghi
jkl
mno
pqr

Or it may show

Code:
 
abc
def
ghi jkl mno
pqr

echo >> $logfile

I have also observed the same behavior when my servers were running HP-UX. But I've not had much like from that side so thought I'd see if there were any insights from this side of the house.

Of course, our in-house Exchange guys insist it must be a *nix issue. Riigght. Smilie
# 2  
Old 08-23-2012
And there is not any message at the top of outlook which says,
Extra line breaks in this message have been removed. Click here to restore. ?
# 3  
Old 08-23-2012
Assuming that your file has records terminated with carriage-return line-feed, we can probably eliminate the format of the file.


There is a little-known "feature" of Microsoft Outlook where a default changed at Outlook 2003 and has been wrong ever since:

From Outlook:
Tools / Options / Preferences /E-mail Options
Uncheck "Remove extra line breaks in plain text messages".
These 2 Users Gave Thanks to methyl For This Post:
# 4  
Old 08-23-2012
We frequently see our exchange server try to dink with carriage control in messages from unix. A common exchange notification when you open the message is:

"extra line breaks in this message were removed" in a blue band at the email head.
Clicking on the band resores the "extra" line breaks.

and we have lines that were separate globbed together by exchange, just like in your example. This appears to be your problem, too. We get arround it:

Code:
# note we add .txt so windows can open the file with word
unix2dos logfile logfile.txt
uuencode logfile.txt logfile.txt | mail -s 'subject'  who@where.com

Exchange does not mess with those attachments.

More of a UNIX-side solution
This User Gave Thanks to jim mcnamara For This Post:
# 5  
Old 08-23-2012
Quote:
Originally Posted by methyl
Assuming that your file has records terminated with carriage-return line-feed, we can probably eliminate the format of the file.


There is a little-known "feature" of Microsoft Outlook where a default changed at Outlook 2003 and has been wrong ever since:

From Outlook:
Tools / Options / Preferences /E-mail Options
Uncheck "Remove extra line breaks in plain text messages".
That seems to have fixed the issue. Thanks


"Have I told you lately how much I dislike Windows?"

---------- Post updated at 12:06 PM ---------- Previous update was at 11:44 AM ----------

Quote:
Originally Posted by jim mcnamara
We frequently see our exchange server try to dink with carriage control in messages from unix. A common exchange notification when you open the message is:

"extra line breaks in this message were removed" in a blue band at the email head.
Clicking on the band resores the "extra" line breaks.

and we have lines that were separate globbed together by exchange, just like in your example. This appears to be your problem, too. We get arround it:

Code:
# note we add .txt so windows can open the file with word
unix2dos logfile logfile.txt
uuencode logfile.txt logfile.txt | mail -s 'subject'  who@where.com

Exchange does not mess with those attachments.

More of a UNIX-side solution

I've used that solution before and while I prefer something I can control from the *nix side, I also prefer - for these jobs - to just dump the log into the body of the mail instead of an attachment.

Also, I really was curious about the cause and not just a work-around without understanding what was really going on. Looks like another find MS "feature". It's really amazing how often I search for a solution to some Windows issue and find that people have been finding and reporting the same issue through multiple versions of Windows for several years and MS still has no answer.
This User Gave Thanks to edstevens For This Post:
# 6  
Old 08-23-2012
The answer to that and many other MS "features" would have been, "don't do that".

But since they did, it is now "standard" in their eyes and will not change unless they feel like it.
# 7  
Old 08-27-2012
@edstevens
Like many Systems Administrators I work with a mixed M$ and unix/Linux (and more) environment. It never ceases to amaze me how M$ can make arbitary unannounced changes to their O/S without considering the consequences. This case was sort of trivial, but had worldwide impact on non-M$ systems.
I personally wasted a day finding out what was different between two of my desktops then spent another day writing-up a fix for umpteen other desktops which had a recent M$ "upgrade".

Previous Thread | Next Thread
Test Your Knowledge in Computers #686
Difficulty: Medium
In reverse Polish notation, the operators follow their operands; for instance, to add 3 and 4, one would write 3 4 + rather than 3 + 4.
True or False?

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Email formatting gets disturbed because of screen resolution

Hi friends, I have written a shell script which send a report to email address everyday. The report is generated on UNIX server every day, Generated report is sent to 25 users through cron. All 25 users have set different screen resolution for their monitor. The email looks wel formatted for... (4 Replies)
Discussion started by: Nakul_sh
4 Replies

2. Linux

Exchange Email Client for Linux

About 5 years ago I used to use Evolution for its ability to interact with my companies Exchange 2003 server. I was wondering what Exchange compliant email clients you are actually using with either Exchange 2007 or 2010? FYI I've tried Thunderbird and it just sucks. (5 Replies)
Discussion started by: binary-ninja
5 Replies

3. UNIX for Dummies Questions & Answers

Formatting The Email Output

Hello All, When i use the single quotes around the variables i am getting each line in the array as seperate in the email as shown in code2 & output2. But i don't want those single quotes to be printed but each array element should be printed as seperate line as when i remove those single quotes... (1 Reply)
Discussion started by: Ariean
1 Replies

4. AIX

Enable send email through smtp - exchange on AIX 6.1

Please help, i can not to send email from AIX 6.1 to outside network through STMP - Exchange. Any one can help ? (1 Reply)
Discussion started by: ichsan
1 Replies

5. Shell Programming and Scripting

Send email from sendmail on AIX using exchange server as SMTP server

i am new in AIX i am trying to write a script to take a backup for specific files on server to and check error log if backup success send email to administrator , script done except for sending mail , i try to configure sendmail on aix to use our exchange server to send emails but still get error... (0 Replies)
Discussion started by: ahmed_salah
0 Replies

6. AIX

aix email integration with exchange

Hi All, I realized now that the root email is integrated with exchange. All the email of root is now being sent also to the aliases of aixadmin or to my email. I would like to know how is AIX integrated to exchange. What would be modified on AIX? Probably modify these files: /etc/hosts,... (0 Replies)
Discussion started by: itik
0 Replies

7. Solaris

Send email from solaris to exchange

Can i send e-mail from solaris to exchange?How can i configure the solaris?thks. (1 Reply)
Discussion started by: jowvid
1 Replies

8. UNIX for Dummies Questions & Answers

Send email using Exchange as SMTP

Hi. I have a Tru64 Unix V5.1 server that I would like to send emails using an exchange server we have on the same network as the smtp of this machine. What are the requirements/configuration that I need to do in order to make this possible. We are planning on emailing error messages and such from... (2 Replies)
Discussion started by: fidodido
2 Replies

9. Shell Programming and Scripting

Email formatting

ok, does anyone know how i can strip out fields i dont want from a mail spool file (eg: /var/mail/usermailbox) and dump to standard output (or file with > filename) ?? i tried using a bunch of grep -v 's but i realized that has two main problems, first of all, if anyone types the text im grepping... (6 Replies)
Discussion started by: norsk hedensk
6 Replies

Featured Tech Videos