| | |
Sending email from a shell script
![]() |
•
•
Join Date: Nov 2006
Posts: 224
Reputation:
Solved Threads: 31
•
•
•
•
have written a shell script in which I use fastmail to send emails from the shell script.
It sends email to my company account with no problem. But I wan to send the same email to a pager number so that the pager goes off when the particular condition occurs.
I see that email is not being send to the pager from this script.
I tried sending email from my company email account to the pager email and the pager goes of with the email from company email account.
Any idea why this might be happening so? Is there anything else that I should use to send emails to pager
Thanks!
•
•
Join Date: May 2008
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
One command does it all ~ :p
echo "Message Content" | mail -s "Subject goes here" you@domain-name.com
How to solve this
•
•
Join Date: Oct 2007
Posts: 399
Reputation:
Solved Threads: 47
Hey There,
You can try piping everything to sendmail -t (mail and mailx use sendmail). The -t flag means you have to specify headers, though, so:
sendmail might be in /usr/sbin/ also.
All the header information, CONTENT and FILE are just placeholders. Hopefully that will help you out. You may see an error in your syslog that the "sender was forced with -f" but that should be okay unless your mailserver won't accept it.
Best wishes,
Mike
You can try piping everything to sendmail -t (mail and mailx use sendmail). The -t flag means you have to specify headers, though, so:
Shell Scripting Syntax (Toggle Plain Text)
(echo "Subject: My Subject";echo "From: my@address.com";echo "To: your@address.com";echo "Reply-To: my@address.com";echo "X-Whatever: Any Other Headers You Want To Include";echo CONTENT;cat FILE)|/usr/lib/sendmail -t
sendmail might be in /usr/sbin/ also.
All the header information, CONTENT and FILE are just placeholders. Hopefully that will help you out. You may see an error in your syslog that the "sender was forced with -f" but that should be okay unless your mailserver won't accept it.
Best wishes,
Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
•
•
Join Date: Apr 2009
Posts: 8
Reputation:
Solved Threads: 1
I am trying to write a shell script that evaluates the size of each user's home directory and if it is greater than 50 MB I want an email to be sent to their user account telling them that they need to reduce the size of their home directory.
url=http://"www.accessbit.com"Atlanta Professional Web Development[/url]
url=http://"www.accessbit.com"Atlanta Professional Web Development[/url]
Last edited by KlementHonza; Jun 27th, 2009 at 4:02 am.
![]() |
Other Threads in the Shell Scripting Forum
- Previous Thread: How to pass a shell variable to a perl command
- Next Thread: shell script
| Thread Tools | Search this Thread |






