Mail sending issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mail sending issue
# 1  
Old 03-06-2012
Mail sending issue

I have a script to run root commands on my server namely (alpha), If this commands run successfully I need to mail to myuser@domain.com
I need the email to be from alpha@domain.com not from root@alpha.com, Is there a way to do this while I'm running the script as a root

Code:
 
 
# cat myscript
 
if ( root command ) == 0
mail -s "Report" myuser@domain.com </tmp/msg

Thanks, Sara
# 2  
Old 03-06-2012
You can try -r alpha@domain.com along with the mail command. But check in your man page as different OS would have their own meanings.
This User Gave Thanks to michaelrozar17 For This Post:
# 3  
Old 03-06-2012
Quote:
Originally Posted by michaelrozar17
You can try -r alpha@domain.com along with the mail command. But check in your man page as different OS would have their own meanings.
Thanks, it is working Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

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

Sending Mail

Hi All, I have a script that looks like this: *********** #!/bin/sh -x cd /u01/app/oracle/diag/rdbms/spdb/spdb/trace cat alert_spdb.log|grep Archiver >/dev/null if ; then mailx -s "Archiver message in Alert log" user@email.com fi ************ Im using the -x option to see any... (1 Reply)
Discussion started by: oradba888
1 Replies

3. Shell Programming and Scripting

Stop sending mail after certain number of mail

Hi guys... I am busy writing a script to notify me via an mail if my application is down. I have done that. Now I want this script to stop sending mails after five mails were sent but the script should keep on checking the application. When the application is up again that count should be... (5 Replies)
Discussion started by: Phuti
5 Replies

4. UNIX for Dummies Questions & Answers

sending mail

i want to send an email from the unix machine to the windows machine. now windows dont have any specified folder for the mail. mail has to be sent to the email-id like abc@xyz.com unix machine itself can not directly send mail. it has to be transferred via mail server. (11 Replies)
Discussion started by: parmeet
11 Replies

5. UNIX for Dummies Questions & Answers

Issue on sending a mail with attachment using unix script ?

Issue on sending a mail with attachment using unix script ? Below is my code and is working fine and there is a issue in the attachment, the attachment file printing as a text-encripted message in the mail draft box instead of putting as a attachment (cat $msg; uuencode $attach1 in1.txt ;... (2 Replies)
Discussion started by: gksenthilkumar
2 Replies

6. Filesystems, Disks and Memory

Sending mail

Hi, I am want to send mails from my aix server using smtp adaptors.How to configure this? i tried with send mail command but it is failing,but what i try with my localhost(my desktop which is not using the aix server) machine i can send mails using the smtp adaptor(simply type telnet... (0 Replies)
Discussion started by: gnanadurai_it
0 Replies

7. Shell Programming and Scripting

Issue in mail sending process

Hi I created one CSV file and i need to append some message in the content of my mail. $sales=sales.dat $sales_csv=sales.csv $sales_report=sales.txt this is the command am using it. echo "sales for `date`"| read subject uuencode $sales $sales_csv | mailx -ms "${subject}."... (2 Replies)
Discussion started by: bobprabhu
2 Replies

8. UNIX for Dummies Questions & Answers

Unix:mail sending issue..pls help me soon

Hi people Can u help me aorund on this cat $DISTRIBUTION_LIST | tail -1 | read mailtolist test -s $INOVOICES.dat if then echo " Sales Report generted" | read subject mailx -ms "${subject}." $mailtolist RET_CODE=$? if ; then echo "Messaging Failed." >> $LOG_FILE exit 1 fi else... (2 Replies)
Discussion started by: bobprabhu
2 Replies

9. UNIX for Dummies Questions & Answers

Sending Mail

Please help me out i want to know how to send email from unix machine to any email-id. mail to be sent is web based mail. (1 Reply)
Discussion started by: parmeet
1 Replies

10. UNIX for Dummies Questions & Answers

sending a mail to a mail client

Hi everyone! I'm trying to create a database monitoring script that reads an alert file and sends an error message if it can 'grep' a particular string. Is there a way to send this message to a mail client using SMTP? Even better, is there any place on this site that has these kinds of... (5 Replies)
Discussion started by: solaris73
5 Replies
Login or Register to Ask a Question