How to add sender's e-mail address to mail -s command ? | 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.

How to add sender's e-mail address to mail -s command ?

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-15-2011
Prat123 Prat123 is offline
Registered User
 
Join Date: Nov 2011
Last Activity: 15 November 2011, 8:53 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
How to add sender's e-mail address to mail -s command ?

Hello Everyone,

I have shell program to send mail, which is working fine.
Below is the syntax to send mail->

Code:
mail -s "$subject" $address

where I am taking Subject and Recipient's address information from variable subject and address as in above syntax.

Now my requirement is to add sender's e-mail address to the above syntax. How to achieve it ?
I am new to Shell programming, please help me out.

I referred below material on Internet but could not find any solution->
Quote:
Commands Reference, Volume 3- mail, Mail, or mailx Command
Please do the needful.
Thanks in Advance.

Prat.
Sponsored Links
    #2  
Old 11-15-2011
rdcwayx rdcwayx is offline Forum Advisor  
Use nawk in Solaris
 
Join Date: Jun 2006
Last Activity: 22 March 2014, 12:27 PM EDT
Posts: 2,759
Thanks: 44
Thanked 418 Times in 406 Posts

Code:
address="mailbox1@xxx.com mailbox2@xxx.com mailbox3@xxx.com"
mailx -s "$subject" $address

Sponsored Links
    #3  
Old 11-15-2011
Prat123 Prat123 is offline
Registered User
 
Join Date: Nov 2011
Last Activity: 15 November 2011, 8:53 PM EST
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Hello rdcwayx,

Thanks for reply.
My shell script using the "Mail" command and same syantax as shown by you i.e

Code:
address="receiver1@xxx.com,receiver2@xxx.com"
mail -s "$subject" $address

where 'address' variable contains all addresses of recipient's. But I want to include sender's e-mail address(FROM adress) along with recipient's address.

Below code shown in your post seems same as mine except "Mailx" command:

Code:
 
address="mailbox1@xxx.com mailbox2@xxx.com mailbox3@xxx.com"
mailx -s "$subject" $address

Please help me out to understand your syntax, if you are setting sender's mail adress also in your code and if my above understanding is incorect.


Thanks in Advance.
Regards,
Prat.
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
mail using mail address in a file gpk_newbie Shell Programming and Scripting 2 09-19-2011 01:28 AM
Script to send mail with From and to address from specific mail server Dharv Shell Programming and Scripting 1 08-29-2011 11:10 AM
How to change sender email address in mail -s command rockf1bull Red Hat 0 02-11-2011 05:57 AM
how to know if the mailx command really sends the mail to the email address? sheenshine Shell Programming and Scripting 3 09-17-2008 08:34 AM
Pull E-mail address from file, send e-mail DC Heard Shell Programming and Scripting 1 01-29-2008 01:23 AM



All times are GMT -4. The time now is 07:41 AM.