User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 403,509 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,142 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 57435 | Replies: 14
Reply
Join Date: Jul 2005
Posts: 2
Reputation: rexwint is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rexwint rexwint is offline Offline
Newbie Poster

Re: Sending email from a shell script

  #11  
Aug 1st, 2005
Hey Shanenin,

Is ther a way to use Linux Sendmail or Mail to send a message to an IP address ?

Thanks,

RexWint
Reply With Quote  
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
shanenin shanenin is offline Offline
Posting Whiz in Training

Re: Sending email from a shell script

  #12  
Aug 1st, 2005
I personally have never used mail or sendmail.
Reply With Quote  
Join Date: Nov 2006
Posts: 174
Reputation: bugmenot is on a distinguished road 
Rep Power: 2
Solved Threads: 27
bugmenot bugmenot is offline Offline
Junior Poster

Re: Sending email from a shell script

  #13  
Oct 27th, 2007
Originally Posted by leoman View Post
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!
f
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: Mithun.kamath is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Mithun.kamath Mithun.kamath is offline Offline
Newbie Poster

Re: Sending email from a shell script

  #14  
May 8th, 2008
Originally Posted by YUPAPA View Post
One command does it all ~ :p

echo "Message Content" | mail -s "Subject goes here" you@domain-name.com


I tried the same but when the mail is send ... The from address is diffirent like <yourlogin@yourmachinename.local>
How to solve this
Reply With Quote  
Join Date: Oct 2007
Posts: 267
Reputation: eggi is on a distinguished road 
Rep Power: 1
Solved Threads: 26
eggi eggi is offline Offline
Posting Whiz in Training

Re: Sending email from a shell script

  #15  
May 8th, 2008
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:

(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!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 12:40 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC