change mail sender in unix aix | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

change mail sender in unix aix

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-28-2009
Arunprasad Arunprasad is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 9 October 2014, 7:41 PM EDT
Location: syn chen
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Java change mail sender in unix aix

Hi All,

I have a ksh script, in which it sends mail successfully but from root id(root@system.com). I want it to be sent as customid@system.com.
I verified man pages of mail, and found '-u userid' option. But it is failing.

code snippet below:
mail -s "subject" -u $customid toaddress@mail.com

I saw some other discussion also, but i cannot find the exact one. Most of the discussion is based on Solaris box, with -r option, that doesn't work in AIX.
Please guide me to make this happen successfully.

Thanks in Advance!
Sponsored Links
    #2  
Old 05-28-2009
rakesh_pagadala rakesh_pagadala is offline
Registered User
 
Join Date: May 2009
Last Activity: 4 January 2010, 7:09 AM EST
Location: hyderabad
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Arunprasad View Post
Hi All,

I have a ksh script, in which it sends mail successfully but from root id(root@system.com). I want it to be sent as customid@system.com.
I verified man pages of mail, and found '-u userid' option. But it is failing.

code snippet below:
mail -s "subject" -u $customid toaddress@mail.com

I saw some other discussion also, but i cannot find the exact one. Most of the discussion is based on Solaris box, with -r option, that doesn't work in AIX.
Please guide me to make this happen successfully.

Thanks in Advance!
Arun ,
Did you tried using mailx command

mailx -s "subject" xyz@zz.com(userid)
Sponsored Links
    #3  
Old 05-28-2009
Arunprasad Arunprasad is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 9 October 2014, 7:41 PM EDT
Location: syn chen
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Java

Thanks for the tip,
But Not working!

i tried like below:
mail -s "test mail from test environment" arunprasad@domain.com (thangaraj)

as per above code, i logged in with my account: arunprasad and i am sending mail to my id, but the mail will be sent as with thangaraj id, not from my id.

Please correct me if my understanding is wrong.
Below is the error message i am getting when execute the above code:
ksh: syntax error: `(' unexpected

Please help me!
    #4  
Old 05-28-2009
rakesh_pagadala rakesh_pagadala is offline
Registered User
 
Join Date: May 2009
Last Activity: 4 January 2010, 7:09 AM EST
Location: hyderabad
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
just try echo "hello world" | mailx -s "SUBJECT" abc@xyz.com
Sponsored Links
    #5  
Old 05-28-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 22 November 2014, 3:53 PM EST
Location: Foxborough, MA
Posts: 7,668
Thanks: 153
Thanked 586 Times in 551 Posts
Start using the Forum's 'Search' functionality to locate similar posts.
The 'google unix.com' is located in the upper right corner of the portal.
Search for sendmail+different+user for example.
Sponsored Links
    #6  
Old 05-28-2009
rakesh_pagadala rakesh_pagadala is offline
Registered User
 
Join Date: May 2009
Last Activity: 4 January 2010, 7:09 AM EST
Location: hyderabad
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Arun ,
Can you help me to understand how to post a question in this form i am able to reply to the questions but not the other way around.. Sorry to trouble you but i am new this site ...any help would be greatly apprecaited
Sponsored Links
    #7  
Old 06-01-2009
Arunprasad Arunprasad is offline
Registered User
 
Join Date: Aug 2008
Last Activity: 9 October 2014, 7:41 PM EDT
Location: syn chen
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
All,

Here i got a point, as my earlier code i have tested was abended due to no mail body.
Here it works with the below:

cat filename.txt | mail -r "\"useridwewant"\" -s "subject" mailid.com

the above is working fine, but the same i tried with -u option in mail command:

cat filename.txt | mail -u "useridwewant" -s "subject" mailid.com

the above command is failing to send mail and throwing me the below error:
"Cannot give this flag and people to send to."

Please help me out.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to change font and colour in mail sent from Unix yogichavan HP-UX 3 07-09-2007 07:41 AM
Change sender e-mail address cchiang12 AIX 3 11-18-2006 03:18 PM
Mail Sender rkapfer UNIX for Advanced & Expert Users 0 07-26-2005 06:16 PM
mail without sender's id! sskb UNIX for Dummies Questions & Answers 3 09-12-2001 01:18 PM
unix mail : sender/reply to bong m UNIX for Dummies Questions & Answers 3 11-15-2000 06:27 PM



All times are GMT -4. The time now is 08:15 AM.