Send email via commandline

35 views
Skip to first unread message

pranav_j

unread,
Mar 31, 2012, 6:03:33 AM3/31/12
to wncc...@googlegroups.com
Hello,

I want to set a cronjob for automaticically sending an email to be IF a process XYZ is not running. The "sending mail via commandline" part is not working.

When I do "mail -s test pra...@iitb.ac.in" the prompt comes back but nothing happens.

Has anybody done this sort of thing before? Please let me know what to do.

Thanks,
Pranav

Bharat Singhvi

unread,
Mar 31, 2012, 6:24:15 AM3/31/12
to wncc...@googlegroups.com
Hi,

You need a properly configured mail server for 'mail' command to work.
You can configure postfix on your system.

Another way to do this is that when a process stops, then a script can log into a remote server which has a configured mailserver. Like for CSE, we have 'mars.cse.iitb.ac.in' which can be used as a mailserver.


Thanks.
Bharat


--
The website for the club is http://stab-iitb.org/wncc
To post to this group, send email to wncc...@googlegroups.com




pranav_j

unread,
Mar 31, 2012, 9:23:09 AM3/31/12
to wncc...@googlegroups.com
Hi Bharat,

Thanks for the reply.

How does one login to a remote mailserver? I googled "log into remote mailserver" but didn't get exact commands. We have sandesh.ee.iitb.ac.in as EE mail server.

ssh ema...@sandesh.ee.iitb.ac.in

didn't work


Thanks,
Pranav

Pranav Jawale

unread,
Mar 31, 2012, 9:45:07 AM3/31/12
to wncc...@googlegroups.com
Nevermind. Got it.
--
*
*
The best way to get something done is to begin.  ~Author Unknown


pranav_j

unread,
Mar 31, 2012, 10:13:09 AM3/31/12
to wncc...@googlegroups.com

It seems I can't send mail to outside email ids (e.g. gmail) through mailx. Is it disabled?

- Pranav

Bharat Singhvi

unread,
Mar 31, 2012, 12:40:52 PM3/31/12
to wncc...@googlegroups.com
No. DNS should be properly configured on the host system which I assume would already be there on 'sandesh'.
Regarding remote login [I have exchanged the RSA keys between my system and remote hosts - so no authentication is needed. Another way to do the same is to use 'expect'.] and mail send operation scripts, I can send them to you if you need them.
Bharat Singhvi
M.Tech II Year,
Dept. of Computer Science and Engineering,
IIT Bombay.

Reply all
Reply to author
Forward
0 new messages