Send email using mail

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Send email using mail
# 1  
Old 01-04-2012
Send email using mail

I need to send an email from linux using mail command. The problem is I can't hardcode the to: emailaddress, The email address is saved in a recipient.lst file on the server in this format:
To: a@b.com


Thanks a lot.

il_labor
# 2  
Old 01-05-2012
Try with the below ..
Code:
$ echo "" | mail -s "Test email" $(nawk -F: '/^To: /{print $2}' recepient.lst)

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

Use of java mail to send email from UNIX

Can someone help me to understand how to configure java mail on unix or what is syntex for that to put in script so email can be sent. earlier i was using 'send mail' to send email and not SMPT is stopped in unix machine and they asked us to use java mail. Before I was using this ... (0 Replies)
Discussion started by: mirwasim
0 Replies

3. Linux

Send email using mail

I need to send an email from linux using mail command. The problem is I can't hardcode the to: emailaddress, The email address is saved in a recipient.lst file on the server in this format: To: a@b.com Thanks a lot. il_labor (1 Reply)
Discussion started by: il_labor
1 Replies

4. Shell Programming and Scripting

Script to Send an email using mail command

Hello all I'm trying to write a script to send an email, so I can be nnotified when something is going wrong with my system. I've tried many options with no luck: mail -s "You've got mail" somebody@example.com echo "Mail Body" | mail -s "Subject" somebody@example.com I tried also to... (1 Reply)
Discussion started by: samer.odeh
1 Replies

5. UNIX for Dummies Questions & Answers

Configuring mail to send email from server to client

Hi, I want to send an email from server to my gmail account for all critical messages reported in the server. Kindly help me in configuring the same. Regards Rochit (1 Reply)
Discussion started by: rochitsharma
1 Replies

6. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

7. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

8. UNIX for Advanced & Expert Users

how to send email using "mail" to google or yahoo

hi all, i need to email the output of a command to a google or yahoo account. am using debian lenny 5. can someone please help me on this ? (5 Replies)
Discussion started by: coolatt
5 Replies

9. UNIX for Dummies Questions & Answers

how to send mail from server to client's email-id

i want to send email from server to the client's email-id. server is solaris. please help me out.i want to send mail to the email-id not to the var/spool/mail. (8 Replies)
Discussion started by: parmeet
8 Replies
Login or Register to Ask a Question