Sending formatted email with sendmail question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending formatted email with sendmail question
# 1  
Old 02-25-2015
Sending formatted email with sendmail question

Hi All,

Can anyone help with an email formatting question:

Im using the following example to try and send a formatted email:

Code:
outputFile="file.txt"  
(  
echo "From: oracle@inovis.com"
echo "To: john.dickinson@gxs.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test Font"   
echo "Content-Type: text/html"
echo "<FONT FACE="COURIER NEW" SIZE="5"</FONT>"
cat $outputFile  
) | sendmail -t

The email is sent ok, but no matter how I try I cant get the right format, ie courier new and the right size.

Any ideas?

Thanks for any help.

jd
# 2  
Old 02-25-2015
It's unclear to me whether html will work in an email like that or not, but in any case, your html had incorrect syntax:

Code:
(  
echo "From: oracle@inovis.com"
echo "To: john.dickinson@gxs.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test Font"   
echo "Content-Type: text/html"
echo "<FONT FACE='COURIER NEW' SIZE='5'>"
cat $outputFile  
echo "</FONT>" ) | sendmail -t

# 3  
Old 02-25-2015
Thanks very much.

That is much better, the size is working now.

However, Im finding that the conetnts of $outputFile is appearing all on one line, ie not with new lines. the content of $outputFile has several lines.

ie the email looks like this:

CURRENT TIME ------------------- 2015/02/25 10:25:53 IWRESOURCE_LOCK (RSRC NAME) AGT_NAME MACHINENAME NUM RSRC_TIME TIMEDIFFMIN ------------------------------------------------------- --------------- -------------------- ------ -------------------- ----------- High Radius - (Prod) - SFTP Inbound SFTP Inbound lsappp08 34 2015-02-25 10:22:53 3 WEICHERT SSN TO AP FTP Inbound FTP Inbound lsappp10.itlogon.com 36 2015-02-25 10:22:59 3 SFTP Inbound - Siemens to Sager (Test) SFTP Inbound lsappp03 32 2015-02-25 10:23:14 3 SFTP Inbound-LLBEAN(MEADOWCRAFT) SFTP Inbound lsappp10.itlogon.com 36 2015-02-25 10:23:15 3 FTP Inbound - Honda to Freudenberg FTP Inbound lsappp02 31 2015-02-25 10:24:02 2 RICOH EUROPE PLC-EDICOM SPAIN - PROD - SFTP Inbound SFTP Inbound lsappp10.itlogon.com 36 2015-02-25 10:24:27 2 SFTP Inbound - Direct Distribution - 945 Pull SFTP Inbound lsappp08 34 2015-02-25 10:24:41 2

How to get the content on a separate line as in the original file? I thorght courier new would do this.

Any ideas?
# 4  
Old 02-25-2015
HTML does that. Putting it in HTML tags has caused it to act like HTML.

If you want the HTML to treat your text as preformatted text, you should put it in preformatted text (<pre>) tags.

Code:
(  
echo "From: oracle@inovis.com"
echo "To: john.dickinson@gxs.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test Font"   
echo "Content-Type: text/html"
echo "<FONT FACE='COURIER NEW' SIZE='5'><PRE>"
cat $outputFile  
echo "</PRE></FONT>" ) | sendmail -t

# 5  
Old 02-25-2015
perfect!
thank you so much :-)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send the email in formatted way

Legends, I have following entries in /tmp/a.txt file 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... (21 Replies)
Discussion started by: sdosanjh
21 Replies

2. Shell Programming and Scripting

Sending attachment using sendmail command

Send_Mail() { C_Date=`date +"%m/%d/%Y"` #Subject="MMDB Load Job Status" for i in `cat $Metafile` do if then email_address=`echo $i | cut -d":" -f2` /usr/lib/sendmail "$email_address" < $Email_File fi done } this is the send mail command i am using .please let me... (1 Reply)
Discussion started by: Alok K Yadav
1 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. UNIX for Dummies Questions & Answers

Sending formatted email from unix.

Hi All, I need to send email from unix in the below format. But the email body is coming all in one single line. How do i format the below text, so that the body of email is properly formatted. Please help. TO: <email id> CC: <none> BCC: <none> Subject: Support: file GENERATION is... (3 Replies)
Discussion started by: abhi_123
3 Replies

5. Red Hat

Delay in sending email to-from localhost in Sendmail

Hi Friends, I am very much new to sendmail or any other mta. I just installed sendmail 8.14 on my rhel6 machine. I was trying to send email to local user but after entering the message when i press CTRL-D it simply hangs. I also tried sending email via mutt but again mutt also hangs. It sends... (0 Replies)
Discussion started by: Rohit Bhanot
0 Replies

6. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

7. Red Hat

Set up Sendmail as sending only server

I have set up where my primary fibre optical WAN access does not have any sending SMTP service but my fall-back ADSL service does. However, with most Internet Service Providers, the SMTP service access is "locked" to the IP addresses that the service knows about. Therefore I can not send SMTP... (0 Replies)
Discussion started by: smlunatick
0 Replies

8. UNIX for Advanced & Expert Users

Sendmail problems -- with sending mail

Hello, I am C. and I would like to send mail with Sendmail to my hotmail-account. But this doesn't work, the mail always returns in the file: /var/spool/mail/root. Probably there is something wrong with my SmartHost. I configured it like: define ( 'SMART_HOST','smtp.direct-adsl.be') -->... (1 Reply)
Discussion started by: caroline
1 Replies

9. Shell Programming and Scripting

Running script that sends an html formatted email fails when its run as cronjob

Hi Im very new at working with unix and this problem I simply can not understand. I know there are a lot of threads about problems with shell scripts behaving differently when run from a terminal and from a cronjob. I have tried everything(almost) but I still havent cracked this problem. Im... (15 Replies)
Discussion started by: Nightowl
15 Replies

10. Shell Programming and Scripting

creating & sending formatted (with bolds & colors) CSV

Hi , I have a situation. Need is to create & send a formatted file with header in BOLD & colored & some sequel results as a content. I know echo -e \033 command, but its scope is limited in PUTTY. How to retain the formatting out of Putty; say after someone opens a email attachment... (2 Replies)
Discussion started by: infaWorld
2 Replies
Login or Register to Ask a Question