Visit The New, Modern Unix Linux Community


sending mail using mailx command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sending mail using mailx command
# 1  
sending mail using mailx command

Hi All,

Please help me regarding sending mails using mailx command in unix.

I will be glad if some one give me the sintax of this. I tried using the below but vain.
mailx -s 'Hi' 'xyz@abc.com'

Regards,
Manas

Last edited by manas6; 12-03-2008 at 06:53 AM..
# 2  
Friends,

My objective is to send mail using my unix command with simple subject line with no body needed.

please help me on this.

Thanks in advance

Regards,
Manas
# 3  
syntax is right except it still needs an end of line character to end the command..

you cat try echo " " | mailx -s 'Hi' 'xyz@abc.com'

or mailx -s 'Hi' xyz@abc.com </dev/null

but all this requires proper mail server configuration on your server.. i mean .. user and domain should be recoganizable ..

Try it ..
# 4  
I use mailx all the time to send output from commands.


/usr/sbin/dmesg | /usr/bin/mailx -s "DMESG - Arielle" csgonan
# 5  
As stated by csgonan .. see he's passing some output to the mailx through pipe.. here it completes the syntax .. what ever you will pass to mailx with pipe or < , it will go as the body of the mail.... so echo " " will pass a single space character .. or else you can user </dev/null is stdin .. if you do not require body ..
# 6  
Excellent!!.

This works. Thanks a bunch friend.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #393
Difficulty: Easy
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems.
True or False?

10 More Discussions You Might Find Interesting

1. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

2. Shell Programming and Scripting

Not able to send the mail using mail and mailx command

Hi All, I am trying to send a mail from linux server but could'nt able to send the mail. I tried the below syntax's so far but no luck. mail -s “Hello world” abc@xyz.com < /usr/g/txt.log cat "txt.log" | mailx -s "Hello world" abc@xyz.com mailx -s “Hello world” abc@xyz.com <... (2 Replies)
Discussion started by: scriptscript
2 Replies

3. UNIX for Dummies Questions & Answers

Mailx working but not sending mail

Hi All, I have a unix server on which mailx is configured . Earlier i was getting proper mails but now some mails are getting stuck and i am not receiving the emails from the server. I can see the mails in mailq. Can you please help me with this . How can i receive these emails? (2 Replies)
Discussion started by: pratikm23
2 Replies

4. Shell Programming and Scripting

How to embed a html file in a mail sending from Linux box with uuencode or mailx?

How to embed a html file as subject in a mail sending from Linux box with uuencode or mailx or any other way? we do not want the file as attachment, it should be embedded in the mail subject. (2 Replies)
Discussion started by: johnveslin
2 Replies

5. Shell Programming and Scripting

mailx -s not sending the file to mail address

Hi All, OS:Red Hat Linux 4 86x64 Below is my shell script which is not sending mail to the mail recipient: #!/bin/bash export MAILLIST="xyz@yahoo.com" cd <path_to_the_script_perf_report.sql> sqlplus / as sysdba @perf_report.sql if then cat <path_to_the_script/*MONTHLY*REPORT*.lst... (6 Replies)
Discussion started by: a1_win
6 Replies

6. Shell Programming and Scripting

sending mail through mailx command

Hi I need help to send mail through mailx command . Currenlt my program is like #!/bin/ksh -x echo " " >> path.lst MAIL_LIST='someone1@gamil.com someone2@gamil.com someone3@gamil.com' cat path.lst | mailx -s "path loaction" $MAIL_LIST echo "End" exit 0 Its work fine . But i... (3 Replies)
Discussion started by: mani_isha
3 Replies

7. Shell Programming and Scripting

sending mail using Mailx with data from oracle table

Hi, i need to send emails to the mail ids i receive using the sql query . SELECT L.ALARM_DEF,L.CRITERIA,L.DISTANCE_METRE,L.EMAIL,L.LAC_ID,L.LAST_CHECK,L.RANGE, L.RESOURCE_MSISDN,LM.ADDRESS,LM.NAME FROM LANDMARK_ALARM_CONF l, LANDMARK lm WHERE L.LANDMARK_ID=LM.LANDMARK_ID AND... (0 Replies)
Discussion started by: aemunathan
0 Replies

8. Shell Programming and Scripting

sending mail from perl using mailx

hi All, i am trying to send a mail from perl using mailx. the script runs fine if i hard code the file path which is to be attached to the mail. but when i give a variable containing the path of the file , perl is not able to send the file. ex: system('uuencode /attach/test.txt... (3 Replies)
Discussion started by: adityamahi
3 Replies

9. Shell Programming and Scripting

sending mail through mailx

while trying to send a mail, though the output file doesn't contain any exclamatory mark(!), i am getting that in the mail with an extra line. please help me out from this ASAP. (3 Replies)
Discussion started by: pvamsikr
3 Replies

10. Shell Programming and Scripting

Problem with mailx command when sending attachment.

Hi, I have tried to sent a mail with body and attachment. But the shell script got hanging while executing that command. The command is "(cat body;uuencode att1.csv)|mailx -s "Production Monitoring Report(Unix Side)" milton.yesusundaram@patni.com" where body is a file having a single line.... (2 Replies)
Discussion started by: miltony
2 Replies

Featured Tech Videos