LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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
Senior Member
 
Registered: Aug 2005
Location: Pensacola, FL
Distribution: Slackware64® Current & Arch
Posts: 1,092

Rep: Reputation: 174Reputation: 174
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,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:15 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration