Sendmail with cat adding extra spaces in email body


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sendmail with cat adding extra spaces in email body
# 1  
Old 04-27-2014
Sendmail with cat adding extra spaces in email body

when I try to read a file and send email using cat and sendmail: The email received having additional spaces.(Between the letters of words in the text)

My code:
Code:
export MAILTO="sa@y.com"

export SUBJECT="mydomain PREPROD MONITOR AT ${DATE}"

export BODY1="/usr/local/oracle/wls1036/domains/mydomain/bin/mydomainmonitor/mydomainmonitor.log"

(

echo "To: $MAILTO"

echo "Subject: $SUBJECT"

echo "MIME-Version: 1.0"

echo "Content-Type:text/html"

echo "Content-Disposition: inline"

cat $BODY1

) | /usr/sbin/sendmail -i $MAILTO

Please let me know why these additional spaces are added. When I check the file I don't see any spaces in there.

Last edited by Scott; 04-27-2014 at 04:20 PM.. Reason: Please use code tags
# 2  
Old 04-27-2014
Where are the "spaces" appearing?
Can you post an example?
# 3  
Old 04-27-2014
If you could show us how the file looks like and how the output is, we can try to help
# 4  
Old 04-28-2014
For example here is my email body:
Code:
owb005:RUNN ING | Sessions:0 | HoggingThreadCount:0 | ThreadPoolState:HEALTH_OK| HeapFreePercent=71
owb006:RUNNING | Sessions:0 | HoggingThreadCount:0 | ThreadPoolState:HEALTH_OK| HeapFreePercent=22
owb007:RUNNING | Sessions:0 | HoggingThreadCount:0 | ThreadPoolState:HEALTH_OK| HeapFreePercent=45
owb008:RUNNING | Sessions:0 | HoggingThreadCount:0 | ThreadPoolState:HEAL TH_OK| HeapFreePercent=69
owb009:RUNNING | Sessions:0 | HoggingThreadCount:0 | ThreadPoolState:HEALTH_OK| HeapFreePercent=17


you can see space betweeb RUNNING and HEALTH_OK words

Last edited by Don Cragun; 04-28-2014 at 06:16 AM.. Reason: Add CODE tags.
# 5  
Old 04-28-2014
Please also post the contents of /usr/local/oracle/wls1036/domains/mydomain/bin/mydomainmonitor/mydomainmonitor.log.
# 6  
Old 04-28-2014
Log file content

Code:
<font face="Consolas"><div>------------------------------------OWB JVM/Deployment Status------------------------------------<br>owb001:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=43<br>owb002:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=27<br>owb003:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=39<br>owb004:SHUTDOWN<br><font color="#ff0000">Alert:owb004 status is SHUTDOWN.</font><br>owb005:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=84<br>owb006:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=10<br>owb007:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=39<br>owb008:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=86<br>owb009:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=32<br>owb010:SHUTDOWN<br><font color="#ff0000">Alert:owb010 status is SHUTDOWN.</font><br>owb011:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=41<br>owb012:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=31<br>owb013:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=28<br>owb014:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=26<br>owb015:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=22<br>owb016:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=29<br>owb017:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=28<br>owb018:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:3  | ThreadPoolState:HEALTH_WARN| HeapFreePercent=31<br><font color="#ff0000">Alert:[ThreadPool has stuck threads]</font><br>owb019:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0<br><font color="#ff0000">Alert:possible issue with deployment status.</font><br>owb020:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=18<br>owb021:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=16<br>owb022:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=36<br>owb023:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=28<br>owb024:RUNNING&nbsp;&nbsp;|&nbsp;Sessions:0&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;HoggingThreadCount:0  | ThreadPoolState:HEALTH_OK| HeapFreePercent=24<br>_____________________________<br>OWB TOTAL Concurrent Sessions:0<br>-----------------------------<br></div></font/><font face=Consolas>
------------------OWB PREPROD SERVER 1 CPU/MEMORY STATUS:------------------<br>
Cpu(s):  3.8%us,  0.6%sy,  0.0%ni, 95.5%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st<br>
Mem:     45308M total,    44740M used,      567M free,      517M buffers<br>
Swap:     4095M total,       83M used,     4012M free,    27338M cached<br>
------------------OWB PREPROD SERVER 2 CPU/MEMORY STATUS:------------------<br>
Cpu(s):  4.9%us,  0.5%sy,  0.0%ni, 94.5%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st<br>
Mem:     45308M total,    44834M used,      473M free,      501M buffers<br>
Swap:     4095M total,       89M used,     4006M free,    26576M cached<br>
------------------OWB PREPROD SERVER 3 CPU/MEMORY STATUS:------------------<br>
Cpu(s):  4.3%us,  0.5%sy,  0.0%ni, 95.1%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st<br>
Mem:     45308M total,    43502M used,     1805M free,      427M buffers<br>
Swap:     4095M total,      123M used,     3972M free,    23275M cached<br>

---------- Post updated at 05:37 AM ---------- Previous update was at 05:36 AM ----------

Its not the spaces will be added in specific location, its totally random, But I dont have those spaces in my file.
Moderator's Comments:
Mod Comment Please use CODE tags when posting sample code, input, and output.


---------- Post updated at 06:20 AM ---------- Previous update was at 05:37 AM ----------

I broke my output to file(while writing to log) into multiple lines using \n.
Now send mail is send email body wiout any spaces.

Last edited by Don Cragun; 04-28-2014 at 07:14 AM.. Reason: Add CODE tags again.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sendmail cmd for html body and attachment not working

Hi, I am having trouble in sending a mail with html body and attachment (csv file). We don't have uuencode or mutt (not allowed to install as well) The below code is perfectly working for sending the html body alone: export MAILTO=abc@xyz.com export CONTENT="/home/abc/list.html"... (2 Replies)
Discussion started by: close2jay
2 Replies

2. UNIX for Dummies Questions & Answers

Sendmail with HTML body and attachment code issues

Hi, I was working on getting an HTML file in the mail body along with attaching a "csv" file to the mail. Below are the 2 parts of the code. I need help with the second part where I'm sending the mail. The HTML file as an attachment is perfect without any issues and with proper formatting.... (6 Replies)
Discussion started by: aster007
6 Replies

3. Shell Programming and Scripting

Email body not formatted with html and sendmail

Hi All, I am trying to send the contents of a file as email body. I am using html email and sendmail option of unix. I am using the below piece of code for the same : #!/usr/bin/ksh export MAILTO="email@domain.com" export SUBJECT="Report" export BODY="file_directory_path/test_file.txt"... (1 Reply)
Discussion started by: rockygsd
1 Replies

4. Shell Programming and Scripting

Sendmail with header and footer logo in HTML body

Hello, I need help with my script that will send email via sendmail command that will shows both the header and footer logo once the recepient receive the email (e.g. MS Outlook). When I tested to ran the script it will successfully send the email BUT UNFORTUNATELY it doesn't displayed the... (8 Replies)
Discussion started by: lawrence88
8 Replies

5. Shell Programming and Scripting

Removing extra unwanted spaces

hi, i need to remove the extra spaces in the 2nd field. Sample: abc|bd |bkd123 .. 1space abc|badf |bakdsf123 .. 2space abc|bqe |bakuowe .. 3space Output: abc|bd|bkd123 abc|badf|bakdsf123 abc|bqe|bakuowe i used the following command, (9 Replies)
Discussion started by: anshaa
9 Replies

6. Shell Programming and Scripting

Sendmail with HTML body and attachment

I have an HTML file I am currently sending in the body of an email. I now have a need to send a csv attachment along with it. I can ONLY use sendmail as mutt and xmail etc are not on the server. Here is what I am currently using: It is possible to add code to add an attachment ??!? { ... (8 Replies)
Discussion started by: atelford
8 Replies

7. Shell Programming and Scripting

Extra control characters being added when I create a file using cat command

Hi, I am using Cygwin.I created a new file and type into it using cat > newfile. When I open this using vi editor, it contains loads of extra control characters. Whats happening? (1 Reply)
Discussion started by: erora
1 Replies

8. Shell Programming and Scripting

Remove extra spaces in a line

Hi, I need a help in deleting extra spaces in a text. I have a huge file, a part of it is :- 3 09/21/08 03:32:07 started undef mino Oracle nmx004.wwdc.numonyx.com Message Text : The Oracle session with the PID 1103 has a CPU time ... (6 Replies)
Discussion started by: vikas027
6 Replies

9. Shell Programming and Scripting

Attaching file and sending text in body using sendmail command!!

Hello, I need to send with text in the body and 2 files as attachments using sendmail command. i can send only one at a time either attachment or text in body of email. Can any one please help me how to get that? I will be great for any help. Thanks, Sparan (1 Reply)
Discussion started by: sparan_peddu
1 Replies

10. UNIX for Dummies Questions & Answers

sendmail message body buffer limit?

when sending the contents of a ascii file to the body of an email then sending it off. it seems sendmail is breaking up the lines with a "!" thus ruining the data. Has this ever happened to anyone? i am guessing there is a line buffer limit in either the mail command or in sendmail itself. ... (3 Replies)
Discussion started by: Optimus_P
3 Replies
Login or Register to Ask a Question