mailx command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mailx command
# 1  
Old 01-20-2012
mailx command

Code:
( 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 desired mail id as if i sent a mail ex : abc@example.com as below

how to get the below result

from :abc@example.com (desired mail id instead of server id )
to : for all contacts in text file mailids.lst

what changes do i need to do ? let me know the syntax

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 01-20-2012 at 09:14 AM..
# 2  
Old 01-20-2012
From man mailx
Code:
         -r address     Pass address to network delivery software.  All
                          tilde commands are disabled.

Please RTFM.
# 3  
Old 01-22-2012
( cat textfile.txt; ) | mailx -s "test mail " -r `mymail@exampl.com` `cat mailids.lst`

i did not get your answer , is the above command works ???

---------- Post updated at 01:18 PM ---------- Previous update was at 01:04 PM ----------

Code:
( cat textfile.txt; ) | mailx -s "test mail " -r `mymail@exampl.com` `cat mailids.lst`




i did not get your answer , is the above command works ???
# 4  
Old 01-22-2012
You don't need the ` (backticks) around the from email ID.
Try this...
Code:
( cat textfile.txt; ) | mailx -s "test mail " -r "mymail@exampl.com" -t `cat mailids.lst`

--ahamed
# 5  
Old 01-23-2012
-r switch is not present on all OS's
Check manual of your unix mailx command.

Regards
Peasant.
# 6  
Old 01-23-2012
Code:
mailx -s "test mail " -r "mymail@exampl.com" -t `cat mailids.lst` <  textfile.txt

Please use above

Last edited by Franklin52; 01-23-2012 at 10:12 AM.. Reason: Please use code tags for data and code samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Mailx command

Using RHEL 5.5 New to using 'mailx' Was trying to check if mailx is configured. mailx command gives a list of unread mails. Now I tried to send mail using this command to a local or on network machine using mailx -s "Test2" "root@<servername>" But did not receive any message. (6 Replies)
Discussion started by: ikn3
6 Replies

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

3. Solaris

mailx command

Dear all, Every time if i use mailx it is asking for entering the From Address. I want to set it in some place, So that it will take it by default whenever we send mails. Pl help on this. Regards JeganR (2 Replies)
Discussion started by: jegaraman
2 Replies

4. Solaris

Mailx command

HI All, I have an unix server , where sendmail command works for sending mail. But if i use mailx command it is not working. Is there any specific settings needed for this. Kindly help. Thanks and Regards Rj (1 Reply)
Discussion started by: jegaraman
1 Replies

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

6. UNIX for Advanced & Expert Users

mailx command

hi, i want to pass a unix variable as the subject of the mail alongwith a string. My part of code is as below.. week_end_dt=`sqlplus -s rsamart@martdev.world/rsamart<<EOF SET FEED OFF; SET TIMING OFF; SET HEADING OFF; SET PAGESIZE 500; SET LINESIZE 1000; select... (14 Replies)
Discussion started by: Jalkukdi@10
14 Replies

7. UNIX for Dummies Questions & Answers

help on mailx command

hi, i want to pass a unix variable as the subject of the mail alongwith a string. My part of code is as below.. week_end_dt=`sqlplus -s rsamart@martdev.world/rsamart<<EOF SET FEED OFF; SET TIMING OFF; SET HEADING OFF; SET PAGESIZE 500; SET LINESIZE 1000; select... (1 Reply)
Discussion started by: Jalkukdi@10
1 Replies

8. Shell Programming and Scripting

mailx command help

Dear All, I need to send a mail to a group ( the address of which is in a .profile file)..My basic mailing functionality isn't working. When i try to run mailx -s "Hello" abc@xyz.com the command does not return to the prompt an runs infinitely. Request you to help me out here along with... (3 Replies)
Discussion started by: kaushikraman
3 Replies

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

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