Send Email To Windows OS Preserving The Format


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Send Email To Windows OS Preserving The Format
# 1  
Old 06-07-2013
Send Email To Windows OS Preserving The Format

I am trying to send an email using mailx and mutt commands with a body inside it. For some reason all the lines in the body are coming as one line, i figured it's not the issue with mailx/mutt but with line feed & carriage returns. So I tried adding carriage returns with below command based on other posts but still it doesn't help me. Can you please help me what i am missing?

Code:
sed 's/$/\r/' unix.txt > win.txt


Actual Code:
Code:
for i in `cat "${GEN_PARAM_LIST3}"`
do
        UNINUM=`echo $i | awk -F"|" '{print $1}'`
        PROVIDER=`echo $i | awk -F"|" '{print $2}'`
        EXTRACT_DT=`echo $i | awk -F"|" '{print $3}'`
        PROCESS_STATUS=`echo $i | awk -F"|" '{print $4}'`

        echo "Provider:"$PROVIDER", Uninum:"$UNINUM", Extract Date:"$EXTRACT_DT", Loading Status:"$PROCESS_STATUS"" \
             >> "${LOG_DIR}"/StageLoadEmailBody

done
(cat ${LOG_DIR}/StageLoadEmailBody) | /bin/mailx -s "Provider File Loaded Successfully" "${EMAIL_LIST}"

Thank you.
# 2  
Old 06-07-2013
I use a .mailrc file:
Code:
set crt=21
set encoding=8bit
set charset=iso-8859-1
# set mimeheader=yes

( here its HP-UX to WIN...)

Just noticed, you have not done a ux2dos /unix2dos before !
Code:
(cat ${LOG_DIR}/StageLoadEmailBody) | ux2dos | /bin/mailx -s "Provider File Loaded Successfully" "${EMAIL_LIST}"


Last edited by vbe; 06-07-2013 at 11:31 AM..
# 3  
Old 06-07-2013
It's still not working. Everything coming in one line
Code:
Informatica Was Able To Successfully Load the Provider File Provider:16, Uninum:710119, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:610000, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710056, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710122, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710139, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710739, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710150, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710549, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710862, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710551, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710973, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710981, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710990, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:810586, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710566, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710659, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710924, Extract Date:2012-09-30, Loading Status:COMPLETED Provider:16, Uninum:710985, Extract Date:2012-09-30, Loading Status:COMPLETED

---------- Post updated at 11:04 AM ---------- Previous update was at 10:57 AM ----------

when i do below i am getting line space between lines which i don't want.

Code:
 echo -e "\r\nProvider:"$PROVIDER", Uninum:"$UNINUM", Extract Date:"$EXTRACT_DT", Loading Status:"$PROCESS_STATUS"" \
             >> "${LOG_DIR}"/StageLoadEmailBody

Output:
Code:
Informatica Was Able To Successfully Load the Provider File


Provider:16, Uninum:710119, Extract Date:2012-09-30, Loading Status:COMPLETED

Provider:16, Uninum:610000, Extract Date:2012-09-30, Loading Status:COMPLETED

Provider:16, Uninum:710056, Extract Date:2012-09-30, Loading Status:COMPLETED

# 4  
Old 06-07-2013
Try removing the \r
# 5  
Old 06-07-2013
What are you using ux2dos or unix2dos ?
Have you tried with the file StageLoadEmailBody without mail e.g.
via samba nfs ftp ... on win and open the file?
It must work here first...
try:
Code:
 ux2dos StageLoadEmailBody>StageLoadEmailBody.txt

and look on you PC if the file is multy line...
# 6  
Old 06-07-2013
Apologies for not posting the version of my OS
Code:
Linux XXXX.com 2.6.18-348.3.1.el5 #1 SMP Tue Mar 5 13:19:32 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

I don't have ux2dos. I tried sending the email to my outlook and yahoo looks ok but outlook its coming in single line or if i use "echo -e \r\n or only \r" its putting an extra space between lines.

To Corona688:
when i tried that i am seeing spaces between lines.

please help
# 7  
Old 06-07-2013
You dont have ux2dos so there is chance you have unix2dos then...

Well if not this is how CFA Johnson does it (In his book and is contributor here...):
Code:
#! /usr/bin/ksh
progname=${0##*/}
CR=$(printf "\r")
tempfile=$(mktemp $progname.XXXXXX) || exit 5
for file
do
   sed -e "s/$/$CR/" -e "s/$CR$CR$/$CR/" "$file" > "$tempfile" &&
   mv "$tempfile" "$file"
done

call it ux2dos and make it executable...

Last edited by vbe; 06-07-2013 at 12:36 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Preserving the format of top command result

hi, I have tried the below command in RHEL5: top|mailx -s "test" "abc@cvf.com" But in the mail the content was not in proper format. Is there any way to preserve the format ? Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

2. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

3. Shell Programming and Scripting

format log file and send in email.

Hi guys i have one script which is as below do some sqlplus output in to $LOG sed '/^$/d' $LOG > /tmp/job.log mv /tmp/job.log $LOG awk '{if ($5=="COMPLETED") {print "backup completed at "$3" "$4 " of " $6 " for " d>> "/home/email.log" } else {print "check backup for " d}}' d="$ORACLE_SID"... (2 Replies)
Discussion started by: tapia
2 Replies

4. UNIX for Advanced & Expert Users

How to send email as HTML format with attachment ?

hi.. Could somebody help me how to sent an attachment using sendmail command and the content is HTML format ?. Below is my code to sent the email as HTML but i do not know how to sent the attachment, please help me To: "BAHARIN HASAN"<baharin.hasan@gmail.com> from: "DATAONE SDN... (4 Replies)
Discussion started by: bh_hensem
4 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

7. UNIX for Dummies Questions & Answers

smbclient print while preserving windows printer settings?

I have successfully gotten AIX to print to a windows shared printer with this command: smbclient -U user%password -W domain -c "print file.ext" the only problem is: I have this print queue set up on the Windows side to overlay an image to all pages. When printing from samba, the overlay... (2 Replies)
Discussion started by: raidzero
2 Replies

8. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies
Login or Register to Ask a Question