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!

Recommended Answers

All 17 Replies

What's the script? (be sure to edit out the email addresses)

I usually just use sendmail directly, like this:

sendmail email@domain.com < ~/maildir/mailmessage

and that works out just fine, never had a problem. You could even use a variable if you wanted:

sendmail $email_addy < ~/maildir/mailmessage

That's always worked for me, assuming that your MTA is sendmail, or it is at least available.

Thanks for your reply.
I tried using sendmail and it gave me error --

sendmail: not found

How can I solve this?

Thanks!

Thanks for your reply.
I tried using sendmail and it gave me error --

sendmail: not found

How can I solve this?

Thanks!

Install sendmail? try using mail instead of sendmail, too.

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.

could you please post your script

One command does it all ~ :p

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

Hi Leoman,
I dont know the solution of this problem and i want a help form you that how to send email from shell script on linux to other email accounts. Can u send me the code at sanju456@rediffmail.com. Sanjeev

Hi,

I have the same problem as Leoman. I am unable to see the solution on the forums.
This is my scenario:
I am trying to send an email to a pager through the shell script on linux. I am able to send an email to an email address from my script as well as from the command line. But, using the same mail command to page myself, fails. Nothing really happens. I don't get paged either from the command line or from my script.
Following is my command :
print "$user, $MESSAGE, $SERVER, `date`" | mail -s "Application $LEVEL PROBLEM" $pager_number
when I replace pager_number with an email address, it works perfectly but when I replace it with a pager number in the format pagernumber@skytel.com , nothing happens.
Can somebody please help ?

Thanks
Deepika

I have been able to send email from the command line to localhost.localdomain, but when I try to send to my own email account at mindspring.com. it does not deliver to my email inbox. Instaed, I get an error message from mindspring.com that says:

Diagnostic-Code; SMTP: 550 Dynamic IPs/open relays blocked
Contact <openmailrelay@abuse.earthlink.net>

Anybody know a way to get around this and get my message deliverd to my inbox at mindspring.com ?

Thanks

it seems earthlink is trying to prevetn spam. That may be tough to get around

Hey Shanenin,

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

Thanks,

RexWint

I personally have never used mail or sendmail.

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

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

I would like to send mail to myself using a for loop.
Like I would like to send email to myself 100 times with a bash shell script. I use to have a script that does this, but I seem to have lost it.

I would like to send mail to myself using a for loop.
Like I would like to send email to myself 100 times with a bash shell script. I use to have a script that does this, but I seem to have lost it.

This thread is over four years old. Please start a new thread to ask your questions.

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]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.