Need to send email from linux (RHEL 5.3) command promt
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Last edited by adhar; 09-24-2009 at 08:39 AM.
Reason: Sorry for flagging URGENT
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 URGENTLY!!!
Regards
Ayon
Please don't create multiple threads to same question,
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 URGENTLY!!!
Regards
Ayon
Please spell out your words, and don't flag your posts as urgent. We volunteer our time to help folks out, so telling us to hurry isn't very nice. If you want 24/7 **URGENT** help, pay for support from someone, and they'll be there for you.
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
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 /]#
I think you need to configure outgoing (SMTP) server for sendmail, so mail can leave your server. This should help:
Quote:
How To Configure Linux Sendmail Clients
All Linux mail clients in your home or company need to know which server is the mail server. This is configured in the /etc/mail/sendmail.mc file by setting the SMART_HOST statement to include the mail server. In the example below, the mail server has been set to mail.my-site.com, the mail server for the my-site.com domain.
define(`SMART_HOST',`mail.my-site.com')
If you don't have a mail server on your network, you can either create one, or use the one offered by your ISP.
Once this is done, you need to process the sendmail.mc file and restart sendmail. To do this, run the restarting script we from earlier in the chapter.
If the sendmail server is a Linux server, then the /etc/hosts file will also have to be correctly configured too.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.