Sendmail in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sendmail in unix
# 1  
Old 09-17-2011
Sendmail in unix

Legends,

I am stuck at the following.
I want to send a mail to my outlook address from unix.

I tried the following code, but it's not sending the mail as desired output.


I have file with the following contents

Code:
> cat /tmp/test
jack
and
jil
climed
up the hill

SEND MAIL CODE

Code:
#!/bin/sh

DATE=`date +%Y%m%d`
HH=`date +%H:%M`

(
echo "From: myname@xyz.com"
echo "To: myname@xyz.com"
echo "Subject: Report -- $DATE"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"

cat /tmp/test
echo " "
) | /usr/sbin/sendmail -t

Code:
OUTPUT is coming like:
jack and jil climed up the hill

While i want the output in the mail same as the file contents.

PLEASE HELP!!!

Last edited by sdosanjh; 09-17-2011 at 06:25 AM..
# 2  
Old 09-17-2011
This will send "hi there" with a subject = "test" to me@mycompany.com
This assumes smtpd is running (could be sendmail daemon, etc.)

Code:
echo "hi there" | mailx -s 'test'  me@mycompany.com

If you need to encode an attachment look into either base64 or uuencode
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Clarifying sendmail configuration - sendmail-client offline

Hi all, I have read about sendmail running as 2 separate process. 1 as a MSP, and the other as the real daemon or MTA. In my current configuration, the sendmail-client is disabled. Both submit.cf and sendmail.cf are left as default untouch I do not specified any mailhost... (3 Replies)
Discussion started by: javanoob
3 Replies

2. UNIX and Linux Applications

Sendmail

Hi All, What is Sendmail.cf? What is it's significance? (2 Replies)
Discussion started by: rafa_fed2
2 Replies

3. UNIX for Advanced & Expert Users

Sendmail questions, SCO 5.0.6 sendmail 8.11.0

I am running SCO 5.0.6 and using sendmail 8.11.0 and having issues with smtp authentication. When trying to send mail the following message will kick back. (reason: 530 5.7.1 Authentication required) 530 5.7.1 Authentication required Not sure what needs to be tweeked in sendmail.cf but I... (1 Reply)
Discussion started by: ziggy6
1 Replies

4. UNIX for Dummies Questions & Answers

Sending mail in UNIX with body and attachment(.txt) using sendmail command

Hi All, In my .ksh script, I am sending an email with body and attachment (.txt) using sendmail command. I am able to receive the attachement along with the body of the mail. But I am getting special characters along with the content in the .txt. Also the alignment is incorrect. Can you please... (7 Replies)
Discussion started by: KRR
7 Replies

5. UNIX for Dummies Questions & Answers

Seek help configuring Sendmail 8.14.4 Unix

Seek help configuring Sendmail 8.14.4 Unix server. Not sure if this is the correct place to post or the Unix/Linux Forums job board. Seeking help configuring sendmail 8.14.4 on my Unix server. It appears I have an open relay. I was advised I need to modify a etc/mail/dir , a command line entry... (0 Replies)
Discussion started by: raecampus
0 Replies

6. Programming

sendmail

hi, i am using sendmail function to send the mail for mail client. when i am sending mime content with attaching with body for the images. the image is not displaying in the mail box. all the mime content stuff is displaying. all the headers are proper. hope the reply for this (0 Replies)
Discussion started by: nagineni
0 Replies

7. UNIX for Dummies Questions & Answers

Using sendmail

I have AIX5.1 I was asked to set up a cron script to send a email containing a CSV file regularly to to a user from the AIX box .I have set up cron scripts for sure but I am not sure of using sendmail. I am not sure how to do this Or even how to send a email from it using sendmail which I believe... (4 Replies)
Discussion started by: rocker40
4 Replies

8. UNIX for Dummies Questions & Answers

Sendmail

We have two SMTP servers and we want to configure them to relay e-mails to the internet. Our point is: We have to configure both SMTP servers to relay the e-mails, in order to, if the first one is down , the Sendmail should relay to the secondary SMTP server. Is there any way to do that? We use... (1 Reply)
Discussion started by: htsubamoto
1 Replies

9. UNIX for Dummies Questions & Answers

"Sendmail" on Unix server (help)

OK, I have just got a dedicated Unix server. This server does not have any form of Sendmail resident. I have called the Server Provider, and they were next to useless ... I am at a loss now. What do I need to do? Help me please :) (2 Replies)
Discussion started by: Strad
2 Replies
Login or Register to Ask a Question