LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-29-2012, 01:41 AM   #1
gajananh999
Member
 
Registered: Aug 2012
Posts: 94

Rep: Reputation: Disabled
How to send a mail using shell script


Dear Everyone,

I new to linux shell programming please can anyone tell me how to send a mail using shell script.

I have done it using php and now i m able to send a mail using PHP (mail) function from my linux machine.

But is there any possibility to send a mail using shell script?
 
Old 11-29-2012, 01:45 AM   #2
SqdnGuns
Member
 
Registered: Aug 2005
Location: Fountain Valley, CA / Thailand
Distribution: Slackware64 14.0
Posts: 981

Rep: Reputation: 88
Quote:
Originally Posted by gajananh999 View Post
Dear Everyone,

I new to linux shell programming please can anyone tell me how to send a mail using shell script.

I have done it using php and now i m able to send a mail using PHP (mail) function from my linux machine.

But is there any possibility to send a mail using shell script?
Maybe this will point you in the right direction.

http://theos.in/shell-scripting/send-mail-bash-script/
 
1 members found this post helpful.
Old 11-29-2012, 01:55 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
Yes you can. But first check whether any mail service is running in your Unix machine or not. For instance,
Code:
ps -ef | egrep "smtp|postfix"
If it is running, then you can use:
Code:
mailx -s "subject" user@example.com < /path/to/file
Where /path/to/file is file containing message i.e. body of the mail.
 
1 members found this post helpful.
  


Reply

Tags
mail, sendmail


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need a shell script to read log file and send mail to relevant recipients. gajanan Linux - Enterprise 2 09-07-2012 01:12 AM
[SOLVED] Linux base shell script with java which check the disk space and send mail to my id dhirendrs Linux - Newbie 2 06-14-2010 11:50 AM


All times are GMT -5. The time now is 06:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration