Need to send email from linux (RHEL 5.3) command promt
Dear All,
I am very new to linux environment. I need a solution where I can send email from my linux command prompt. I have a linux server where Oracle is installed and I have a seperate SMTP server for mailing purpose for my office. Now based on some activity in the oracle I need to send email from this server automatically to the respective email id's in the company. As I told earlier I have a SMTP server, I only need to send mail from the oracle installed linux server to the individuals. I have installed RHEL 5.3 where oracle is running. One senario is when oracle writes a file say a alert file or trace file in the path say /oracle/admin/udump/trace directory a email will be send to our dba at dba@xxx.ae Mean to say when a OS file is generated or updated in the above linux path a mail should be fired from linux command prompt PLZ HELP!!! Regards Ayon |
Quote:
i have replied to this thread of yours - http://www.linuxquestions.org/questi...-promt-757273/ |
Quote:
Read the man pages for the sendmail and mailx commands. They send mail from the command line, and are widely used. However, you will need to configure some sort of mail transport agent (like sendmail or postfix), on your system, so it knows how to route the mail outwards. All that depends on your environment. If you already have an internal mail host, find out if it supports incoming relay connections. If it does, configure postfix to use it as a relay host (lots of info on Google for this), then use mailx to send messages. |
Sounds like you need to write a custom prog eg in Perl to monitor whatever your specific conditions are and send the email.
Apparently you've got an MTA (SMTP Transport) running; I'd guess sendmail. You can test it from the cmd line like echo "Test email body" | mailx -r you@xxx.com -s "Test Email" to check you've got email connectivity. If you want a perl sub that does the equiv, post a reply here. |
Sorry---did not see that the other one was closed
|
Dear All,
Very Very sorry for posting 2 threads. I was little confused whether I was posting to correct forum. And I apologies for flagging as "urgent". I am very new to linux and forums.... sorry once again. Hi ak@shdubey When I run the commands as told by you following are the outputs: [root@erpnonprod /]# ps -aef |grep mail root 3591 1 0 Sep15 ? 00:00:00 sendmail: accepting connections smmsp 3600 1 0 Sep15 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue root 24615 24578 0 09:11 pts/1 00:00:00 grep mail [root@erpnonprod /]# rpm -qa |grep mail mailcap-2.1.23-1.fc6 procmail-3.22-17.1 mailx-8.1.1-44.2.2 sendmail-8.13.8-2.el5 fetchmail-6.3.6-1.1.el5 sendmail-cf-8.13.8-2.el5 [root@erpnonprod /]# rpm -qa |grep mail adhar@xxx.ae grep: adhar@xxx.ae: No such file or directory [root@erpnonprod /]# Hi chrism01, How do I know sendmail is working or not. If no then how to configure it. When I run echo "Test email body" | mailx -r adhar@xxx.ae -s "Test Email" command following are the output [root@erpnonprod /]# echo "Test email body" | mailx -r adhar@xxx.com -s "Test Email" mailx: invalid option -- r Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ... [-- sendmail-options ...] mail [-iInNv] -f [name] mail [-iInNv] [-u user] [root@erpnonprod /]# then I gave the following command...but no mail was send to my outlook express mailbox.... root@erpnonprod /]# echo "Test email body" | mailx to adhar@xxx.ae -s "Test Email" [root@erpnonprod /]# Thanks all for your kind help.. Regards Ayon |
I think you need to configure outgoing (SMTP) server for sendmail, so mail can leave your server. This should help:
Quote:
Better option for setting up linux servers for me is Webmin package: http://prdownloads.sourceforge.net/w...0-1.noarch.rpm . It has nice web interface on https://<yourIPorDomainName>:10000 (standalone web server, no Apache necessary) and you can setup (almost) ANYTHING on your server. Very powerfull tool to have and to use. It also has THIRD PARTY (by author of Webmin) Oracle module made in 2006. I would not use it to change any settings on production server, but viewing made changes and current setup of your Oracle server would come handy. |
Hi DrLove73,
Resolved!! Thanks |
In order to send the contents of somefile in an email VIA command line, first check to see if sendmail is running.
Code:
service sendmail restart Code:
cat <path to some file> | mailx -s "my subject" someone@example.com |
All times are GMT -5. The time now is 11:18 AM. |