Unable to send the email in formatted way


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Unable to send the email in formatted way
# 1  
Old 08-21-2014
Unable to send the email in formatted way

Legends,

I have following entries in
Code:
/tmp/a.txt

file

Code:
GAP Ric XEOJ181477500.W Flag2 5 Sym XEO1418J775-E msg SEQ_NO:159 db:5 diff 154 process msg
GAP Ric XEOJ181400.W Flag2 19 Sym XE418J815-E msg SEQ_NO:101 db:5 diff 96 process msg
GAP Ric XEOJ18140.W Flag2 18 Sym XEO18J855-E msg SEQ_NO:88 db:5 diff 83 process msg
GAP Ric XEOK221400.W Flag2 18 Sym XE422K690-E msg SEQ_NO:104 db:5 diff 99 process msg
GAP Ric XEOJ181400.W Flag2 3 Sym XEO18J705-E msg SEQ_NO:83 db:5 diff 78 process msg
GAP Ric XEOJ1814500.W Flag2 23 Sym X1418J865-E msg SEQ_NO:85 db:5 diff 80 process msg

I am using the following in sendmail but the email is coming in plain text without any new line as per the file

Code:
#!/usr/bin/bash
{
echo "From: "
echo "To: abc@xyz.com"
echo "Subject: GAPReport"
echo "Content-Type: text/html"

cat /tmp/a.txt
} | /usr/sbin/sendmail -t

Please help me getting a formatted email in the inbox
# 2  
Old 08-21-2014
If you like you can add attachment to the email.
Code:
uuencode path/file file | mailx -s "your subject" sender@email.com

Code:
Else use 
Mailx -s "your subject" sender@email.com< path/file

This User Gave Thanks to Mannu2525 For This Post:
# 3  
Old 08-21-2014
No luck with mailx. Actually after some code written in script i am sending the email.
I am not using mailx from command prompt.
Sorry if i was not clear in my first post
# 4  
Old 08-21-2014
Hello sdosanjh,

Could you please try following and let me know if this helps.

Code:
cat - ${Filename} <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $SUBJECT
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF

NOTE: Where Filename, MAILFROM, MAILTO, SUBJECT are the variables which you can define them.


Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 5  
Old 08-21-2014
I got the email as HTML format now, but there is no new lines.
everything is in continuation

Code:
GAP Ric FEYEI201402550.M4 Flag2 10 Sym FEYE1420I25.5-4 msg SEQ_NO:1223 db:5 diff 1218 process msg GAP Ric FEYEI201402850.M4 Flag2 11 Sym FEYE1420I28.5-4 msg SEQ_NO: 2233 db: 5 diff 2228 ; Process msg GAP Ric FEYEI201403150.M4 Flag2 15 Sym FEYE1420I31.5-4 msg SEQ_NO:982 db:5 diff 977 process msg GAP Ric FEYEI201402300.M4 Flag2 13 Sym FEYE1420I23-4 msg SEQ_NO:342 db:5 diff 337 process msg GAP Ric FEYEI201402350.M4 Flag2 21 Sym FEYE1420I23.5-4 msg SEQ_NO:739 db:5 diff 734 process msg GAP Ric FEYEI201403650.M4 Flag2 17 Sym FEYE1420I36.5-4 msg SEQ_NO:263 db:5 diff 258 process msg GAP Ric FEYEI201402450.M4 Flag2 23 Sym FEYE1420I24.5-4 msg SEQ_NO:565 db:5 diff 560 process msg GAP Ric FEYEI201403350.M4 Flag2 9 Sym FEYE1420I33.5-4 msg SEQ_NO:465 db:5 diff 460 process msg GAP Ric FEYEU201402300.M4 Flag2 11 Sym FEYE1420U23-4 msg SEQ_NO:403 db:5 diff 398 process msg GAP Ric FEYEU201402450.M4 Flag2 3 Sym FEYE1420U24.5-4 msg SEQ_NO:703 db:5 diff 698 process msg GAP Ric FEYEU201402850.M4 Flag2 15 Sym FEYE1420U28.5-4 msg SEQ_NO:1940 db:5 diff 1935 process msg GAP Ric FEYEU201403450.M4 Flag2 15 Sym FEYE1420U34.5-4 msg SEQ_NO:842 db:5 diff 837 process msg GAP Ric FEYEU201403350.M4 Flag2 17 Sym FEYE1420U33.5-4 msg SEQ_NO:869 db:5 diff 864 process msg GAP Ric FEYEU201403650.M4 Flag2 9 Sym FEYE1420U36.5-4 msg SEQ_NO:462 db:5 diff 457 process msg GAP Ric FDOI201406950.QB Flag2 17 Sym FDO1420I69.5-J msg SEQ_NO:31 db:5 diff 26 process msg GAP Ric FDOI201407350.QB Flag2 3 Sym FDO1420I73.5-J msg

# 6  
Old 08-25-2014
Can someone pls help, issue is still open.
# 7  
Old 08-25-2014
Code:
awk 'BEGIN{print "<pre>"}1' ORS='<br>' ${Filename} <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $SUBJECT
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF

This User Gave Thanks to SriniShoo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Unable to send email using Java in Linux

Hi All, We recently moved to Red Hat Enterprise Linux Server release 6.6 from Solaris 10. The existing Java code to send emails in Solaris is public class card_cardMessenger{ /** * Send an e-mail message via the Runtime class * @see Runtime * @return boolean (success or failure of... (1 Reply)
Discussion started by: Meghan2525
1 Replies

2. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

3. Linux

Unable to send email with sendmail from PHP 5.3 on CentOS VM

I have a longstanding issue on my CentOS 5.6 VM where I am unable to send email from my PHP application. This is the last bunch of lines from my /var/log/maillog file. Feb 14 10:29:16 dev53 sendmail: s1EATEEo004637: Authentication-Warning: www.craig.dev-crmpicco.lan: apache set sender to... (2 Replies)
Discussion started by: crmpicco
2 Replies

4. Shell Programming and Scripting

urgent: Not able to send the html formatted message from mailx

<html> <body style=background-color:AliceBlue> <p>Hi,<pre>please check the connectivity status of the server. <pre> And find the server log file for more details. </p> <h1><font size="4">SERVER <font color="red">111.111.11.1</font> IS NOT AVAILABLE IN ONLINE</font></h1> <font color="red"... (5 Replies)
Discussion started by: jothi basu
5 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

Unable to send email to the outside world

Hi all, Iam unable to send mail from my unix machine(solaris x86,version 5.10) to the outside world. I can able to access the internet,but not able to send to any yahoo or company email id. Before posting this,i have searched this forum many times,but could not get the results what i... (5 Replies)
Discussion started by: jayaprakash
5 Replies

7. Shell Programming and Scripting

unable to send an email attachment

i know its pretty repeated query, but i need to post it in this new thread coz i need it urgently uuencode /var/tmp/chandra/emaillist.txt emaillist.txt | mail -s "message with encoded attachment" am unable to send the attachment emaillist.txt present in the path /var/tmp/chandra/ Is... (11 Replies)
Discussion started by: cmaroju
11 Replies

8. 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

Featured Tech Videos