How to use mailx command in shellscript?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to use mailx command in shellscript?
# 1  
Old 04-14-2011
How to use mailx command in shellscript?

Hi,

i have run the below script in bash ...after running this command iam not getting any error but i am not getting the mail.Can anybody help me regarding this issue?
Code:
#! /bin/bash
x=50
if [ $x -gt 25 ]
then
  mail -s "$x is greater than 25" manish.gupta@gmail.com
fi


Last edited by Franklin52; 04-14-2011 at 08:42 AM.. Reason: Please use code tags and indentation
# 2  
Old 04-14-2011
If you use gmail there is a problem.

gmail refuse mail that are coming from unknown hosts.

You have to use smtp
# 3  
Old 04-14-2011
how to use smtp... can u plz tell me in detail code.
i am new to this.


2)If i want to mail it to my company id then can i?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shellscript command to remove files starting with a certain string, and older than 3 days

Hi All, Need help in identifying a shellscript command to remove all files on a server directory, starting with a certain prefix and also older than 3 days. That means files created with that prefix, today or yesterday, shouldn't be removed. Thanks, Dev (3 Replies)
Discussion started by: dev.devil.1983
3 Replies

2. HP-UX

Help with Mailx command

I need to do below in mailx : 1. to list 2. CC list (I am using tilde command for this) 3. -r option 4. attach .csv file Below is the command i am using : ( echo '~c abc@xyz.com'; cat mailtext.txt; uuencode attach.csv attach.csv) | mailx -s "${SUBJECT}" -r "abc@xyz.com" -m ${MAIL_LIST}... (4 Replies)
Discussion started by: ManOfSteel
4 Replies

3. Shell Programming and Scripting

cc and bcc and to command in shellscript

Hi All, I have tried some below commands , some of these are working. some are not working. I want to add this "TO ,cc, bcc, from " in shellscript. can anyone give me the example for this. mailx -s "$SUBJECT5" "$EMAIL" < $EMAILMESSAGE above code is working but i want to... (5 Replies)
Discussion started by: aish11
5 Replies

4. Shell Programming and Scripting

mailx command

( cat textfile.txt; ) | mailx -s "test mail " `cat mailids.lst` from :'server@example.com' to : for all contacts in text file mailids.lst above command is sending mails correctly for all contacts in text file mailids.lst, but 'from' address is showing as 'server@example.com' but i want... (5 Replies)
Discussion started by: only4satish
5 Replies

5. Shell Programming and Scripting

remove newline between two string with sed command in unix shellscript

I have a file (test.dat) which contains data like this 459|199811047|a |b |shan kar|ooty| 460|199811047|a |bv |gur u|cbe| but I need it like: 459|199811047|a |b |shankar|ooty| 460|199811047|a |b |guru|cbe| While reading the data from this file, I don't want to remove newline from the end of... (4 Replies)
Discussion started by: jcrshankar
4 Replies

6. UNIX for Dummies Questions & Answers

mailx command

Hi, I am seeing that this command is sending mail even when the nawk command in untrue ( does not have any output ). I only want it to send mail, where it goes above the threshold, and has some output. nawk -F'(MOD dn="uid=)|(DEL dn="uid=)|' '/(MOD dn="uid=)|(DEL dn="uid=)/... (2 Replies)
Discussion started by: john_prince
2 Replies

7. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

8. UNIX for Advanced & Expert Users

Mailx Command

Hi, mailx -s "hi" -r "abc@yahoo.com" aaa@yahoo.com<<EOF Hi, ~<!uuencode a.txt a.txt EOF the above code is sending mails, but attachment is not going instead i just get like below ~<!uuencode a.txt a.txt Thanks. (3 Replies)
Discussion started by: shahnazurs
3 Replies

9. UNIX for Dummies Questions & Answers

PS command doesnot display shellscript runningi

PS command doesnot display shellscript runningi have written a small shel script to check for idsk space and log it to a file evry 300s.this so this run is a loop. But i want to start stop this script from another script using ps -ef grep but ps -ef is not displaying the script in output, if i... (1 Reply)
Discussion started by: mpauls
1 Replies

10. Shell Programming and Scripting

mailx command

Hi friends, i have seen the following line in some unix shell script . can some one explain me what exactly the statement is meant for ? ========================================================= mailx -s " Master Data Transmission Report for $TODAY at $TIME " < /etc/tr/tmp/$tmplog... (5 Replies)
Discussion started by: sveera
5 Replies
Login or Register to Ask a Question