Unix/Linux Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

email from *nix to Exchange - text formatting issue

Windows & DOS: Issues & Discussions


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-23-2012
edstevens edstevens is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 21 August 2017, 7:48 AM EDT
Posts: 82
Thanks: 18
Thanked 12 Times in 12 Posts
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. Linux
Sponsored Links
    #2  
Old Unix and Linux 08-23-2012
neutronscott's Unix or Linux Image
neutronscott neutronscott is offline Forum Advisor  
script kiddie
 
Join Date: Jun 2011
Last Activity: 21 September 2017, 10:02 PM EDT
Location: South Carolina, USA
Posts: 941
Thanks: 31
Thanked 303 Times in 281 Posts
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. ?
Sponsored Links
    #3  
Old Unix and Linux 08-23-2012
methyl methyl is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 8 June 2016, 9:58 PM EDT
Posts: 6,402
Thanks: 288
Thanked 676 Times in 645 Posts
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".
The Following 2 Users Say Thank You to methyl For This Useful Post:
edstevens (08-23-2012), neutronscott (08-23-2012)
    #4  
Old Unix and Linux 08-23-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 17 October 2017, 10:50 PM EDT
Location: NM
Posts: 11,212
Thanks: 567
Thanked 1,110 Times in 1,024 Posts
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
The Following User Says Thank You to jim mcnamara For This Useful Post:
vgersh99 (08-23-2012)
Sponsored Links
    #5  
Old Unix and Linux 08-23-2012
edstevens edstevens is offline
Registered User
 
Join Date: Oct 2011
Last Activity: 21 August 2017, 7:48 AM EDT
Posts: 82
Thanks: 18
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by methyl View Post
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 View Post
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.
The Following User Says Thank You to edstevens For This Useful Post:
methyl (08-23-2012)
Sponsored Links
    #6  
Old Unix and Linux 08-23-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 17 October 2017, 2:51 PM EDT
Location: Saskatchewan
Posts: 22,464
Thanks: 1,139
Thanked 4,259 Times in 3,933 Posts
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.
Sponsored Links
    #7  
Old Unix and Linux 08-27-2012
methyl methyl is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 8 June 2016, 9:58 PM EDT
Posts: 6,402
Thanks: 288
Thanked 676 Times in 645 Posts
@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".
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Enable send email through smtp - exchange on AIX 6.1 ichsan AIX 1 08-09-2011 03:03 AM
aix email integration with exchange itik AIX 0 05-12-2008 12:20 AM
Send email from solaris to exchange jowvid Solaris 1 08-21-2006 05:14 AM
Send email using Exchange as SMTP fidodido UNIX for Dummies Questions & Answers 2 01-20-2006 09:05 AM



All times are GMT -4. The time now is 10:51 AM.