Sending email in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending email in shell script
# 1  
Old 03-23-2015
Sending email in shell script

Can anyone help me out how to send the email without the word success
while sending to the recipient.

Code:
echo "success" | mailx -s "webshell instance has been started noiw" implementation@tkcl.com

# 2  
Old 03-23-2015
Quote:
Originally Posted by ramkumar15
Can anyone help me out how to send the email without the word success
while sending to the recipient.

Code:
echo "success" | mailx -s "webshell instance has been started noiw" implementation@tkcl.com

Perhaps you could be a little more specific about what you do want to send in the email.

Maybe you want something like:
Code:
echo "failure" | mailx -s "webshell instance has been started noiw" implementation@tkcl.com

or:
Code:
mailx -s "webshell instance has been started noiw" implementation@tkcl.com < /dev/null

This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 03-23-2015
thanks a lot don. It works now.

any emails which I sent through unix whetehr it will be stored in any of the folders in unix.
# 4  
Old 03-23-2015
Hello Ramkumar15,

check /var/log/maillog or /var/log/messages if you're on *nixOr, on *nix, look in /etc/syslog.conf to see where else those log messages might be getting sent to, hope this may be helpful to you.

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 5  
Old 03-23-2015
hi ravinder. thanks a lot. it works now.

Currently, I have one more issue, where one of the user alone not receiving the email while sending email from unix servers.

Apart from everyone receieves the email. do you have any idea what would be the cause.

---------- Post updated at 07:27 AM ---------- Previous update was at 07:16 AM ----------

error :

Code:
 
Mar 23  07:19:46 us890 sendmail[28636]: kifdsh@jus.com, delay=00:00:02, mailer=relay, relay=[reno], stat=Transient parse error -- message queue

# 6  
Old 03-23-2015
Hello Ramkumar15,

Could you please let us know how is resolv.conf setup ?? Or nsswitch.conf too.

Thanks,
R. Singh
# 7  
Old 03-23-2015
Code:
cat nsswitch.conf
#
# /etc/nsswitch.compat:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# uses NIS (YP) in conjunction with files.
#
passwd:       files [NOTFOUND=continue] nis
group:        files [NOTFOUND=continue] nis
hosts:        files [NOTFOUND=continue] dns nis
#hosts:        files [NOTFOUND=continue] dns [NOTFOUND=continue] nis
networks:     files [NOTFOUND=continue] nis
protocols:    files [NOTFOUND=continue] nis
rpc:          files [NOTFOUND=continue] nis
publickey:    files [NOTFOUND=continue] nis
netgroup:     files [NOTFOUND=continue] nis
automount:    files [NOTFOUND=continue] nis
aliases:      files [NOTFOUND=continue] nis
services:     files [NOTFOUND=continue] nis


Last edited by ramkumar15; 03-23-2015 at 10:55 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. AIX

Sending script output as email

Hi i have a script which executes daily through cron. The output of the script is appended to a log file everyday It also emails me the output of the logfile as we have the mailx command in the script The below is my requirement : Normally When I get the email it sends the entire content... (3 Replies)
Discussion started by: newtoaixos
3 Replies

3. Shell Programming and Scripting

Sending email from shell script

Hi, I need to send email from a shell script. i echoed some information to a file and i am doing cat command in the email syntax thanks (2 Replies)
Discussion started by: rocky1954
2 Replies

4. Shell Programming and Scripting

Configure gmail in linux shell for sending email

Hello, i have a problem sending emails in the command line. I have introduced this command: sendEmail -f my.account@gmail.com -t myself@domain.tld \ -u this is the test tile -m “this is a test message” \ -s smtp.gmail.com \ -o tls=yes \ -xu usernameonly -xp mypasswd but then i received... (1 Reply)
Discussion started by: limadario
1 Replies

5. Shell Programming and Scripting

Shell script for sending automatic email to personal mail id

hi guys, I need a shell script to send mail automatically to my personal mail id like xxxx@hotmail.com but while experimenting with "mail" command I faced following problems. cat text1.txt | mail -s 'test mail' xxxx@hotmail.com command successfully executed but while checking for... (4 Replies)
Discussion started by: rrd1986
4 Replies

6. Shell Programming and Scripting

sending email from a ksh script

hi all, i have a ksh script which is meant to send an email with an attachment. i use the following command to send email /usr/bin/uuencode $logFn $logFn | /usr/bin/mail -s "restoration results" $EMAILTO; where '$logFn' is the name of the file including the full path e.g... (0 Replies)
Discussion started by: cesarNZ
0 Replies

7. Shell Programming and Scripting

Running a shell script in cron...email not sending - help??

I am pretty new to Unix shell scripting, but wondered if anyone could help (in layman's terms if possible!!) :) I have a shell script which ultimately sends an alert to an email address if part of a batch of programs fails. Here's the script that sends the email: Script: 6check.csh... (8 Replies)
Discussion started by: tjhorwood
8 Replies

8. UNIX for Dummies Questions & Answers

Email sending through a shell script

Hi everyone, I have a shell script that I use to send some emails with attachments. Based on the attachment file that is being sent, I choose the recipient. My file_list.txt looks like this CAJ.txt;sm@email.com KXLD.txt;jc@email.com I do a grep on this file to look for the file name and... (3 Replies)
Discussion started by: memonks
3 Replies

9. Shell Programming and Scripting

Sending attachments using email through shell script

Hi all, I have written a shell script which sends emails with attachments to our clients. All our attachments are simple flat files (.txt format). The script is working fine and sending the attachments to the mail-ids except that, when i am sending the attachments to non-outlook users (Like... (6 Replies)
Discussion started by: symhonian
6 Replies

10. Shell Programming and Scripting

sending email from KSH unix script.

Hi Need guidance on including code to mail a couple of files atached with some subject and mail body !!.. Thanks in advance (3 Replies)
Discussion started by: rosh0623
3 Replies
Login or Register to Ask a Question