LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-04-2005, 09:04 PM   #1
djionel82
LQ Newbie
 
Registered: Apr 2005
Location: Romania
Distribution: fc3
Posts: 13

Rep: Reputation: 0
send email from command line


Hi, ppl!
Is there a command in linux which will help me send an email ?

What I am trying to do is write a server program which reads an instruction from the client.
The instruction is read, by the client program, from the command line.
I want that instruction to send an email without any user interaction.
The user enters the command for sending an email and the client program takes that command and forwards it to the server which interprets it.

So the command should include as parameters the to, subject and body fields.
or perhaps a file from where these infos should be read.
 
Old 05-04-2005, 09:22 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,503

Rep: Reputation: 174Reputation: 174
"Is there a command in linux which will help me send an email ?"

You might be able to use pine.

http://www.washington.edu/pine/

http://www.washington.edu/pine/man/

-----------------------------
Steve Stites
 
Old 05-04-2005, 09:28 PM   #3
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 47
here is a past thread with a similar issue...
http://www.linuxquestions.org/questi...hreadid=318556

Don't know what mail client you are using but you should be able to use "mail"
"Paraiso" credited for this code:

echo "This is a test" | mail -s test name@hotmail.com

I use Kmail, and the string below works for me on the command line, however, It opens Kmail composition window, everything is populated correctly but I have to hit Ctrl+Return to acutally send it out.

kmail -s test --body "this is a test" my_address@gmail.com

Maybe someone could tell me How I can | pipe the Ctrl+Return to Kmail so it will send automatically.

Hope this helps.

KC
 
Old 05-04-2005, 09:32 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,972
Blog Entries: 11

Rep: Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877Reputation: 877
mail/nail/exim/mimesend/... ?
 
Old 05-04-2005, 09:53 PM   #5
djionel82
LQ Newbie
 
Registered: Apr 2005
Location: Romania
Distribution: fc3
Posts: 13

Original Poster
Rep: Reputation: 0
yes

thanks for the answers guys ...
I know about pine, mutt, sendmail as commands used to send email.
wht I need is a command which does this automatically without any user interaction.
kencaz got the idea.

kencaz:
Thannx for te advice. I'll give it a try ..
 
Old 05-08-2005, 10:42 AM   #6
djionel82
LQ Newbie
 
Registered: Apr 2005
Location: Romania
Distribution: fc3
Posts: 13

Original Poster
Rep: Reputation: 0
I got it!

cat file.txt | mail -s subject id@yahoo.com
with this instruction the content form file.txt is sent to id@yahoo.com without any other user interaction.
thank you for your help
 
Old 11-29-2005, 12:12 AM   #7
rootking
Member
 
Registered: Sep 2002
Distribution: FreeBSD
Posts: 70

Rep: Reputation: 15
Re: I got it!

Quote:
Originally posted by djionel82
cat file.txt | mail -s subject id@yahoo.com
with this instruction the content form file.txt is sent to id@yahoo.com without any other user interaction.
thank you for your help
I am having problems sending through command line as well. I have the same issue as you had. Except when I issue this command I get this error in /var/log/maillog:

Code:
Nov 28 23:11:55 joelserver sendmail[25479]: jASNBtjC025479: to=myemailaddress@myemail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=3
0379, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused
by [127.0.0.1]
I am also running FreeBSD 6.0.

thanks
 
  


Reply


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
send email with mutt on command line naijaguy Linux - General 1 12-29-2004 06:33 PM
Sendmail question How to send email from command line anjaan Linux - General 1 07-08-2004 08:20 PM
How to send an mime/html-email by command line ? fluppi Linux - Networking 0 07-08-2004 09:26 AM
trying to send internet email from a command line...is it possible rutman Linux - Newbie 8 06-26-2004 02:19 AM
Can Pine send an email without from the command line without.. rutman Linux - Newbie 2 06-11-2004 04:34 PM


All times are GMT -5. The time now is 03:08 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