LinuxQuestions.org
Review your favorite Linux distribution.
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 03-09-2005, 12:36 AM   #1
RomanG
Member
 
Registered: Jan 2005
Location: Russia, Kazan
Distribution: Mandrake 10.2, RedHat sometimes..
Posts: 110

Rep: Reputation: 15
sending mail via CLI


hello all!
i need to send a mail (one text file) from command line using sendmail. and also i do not want sendmail to stop and ask me to type a recipient or smth. else. i think this would look like "cat somefile.txt > sendmail 'and some options (recipient at least) i don't know' " what options should i use?
 
Old 03-09-2005, 02:15 AM   #2
drumvudu
Member
 
Registered: Jul 2004
Location: Houston, Texas USA
Distribution: Linux Mint
Posts: 57

Rep: Reputation: 15
If you just want to send text to someone from the shell just give a: mail -vs "subject" someone@someplace.com and hit enter.
then type your text. When you are finished, put a period by itself on the last line and hit enter. You will see it go through OR not.../peter
 
Old 03-09-2005, 02:18 AM   #3
drumvudu
Member
 
Registered: Jul 2004
Location: Houston, Texas USA
Distribution: Linux Mint
Posts: 57

Rep: Reputation: 15
I just reread your post. I'm not sure if you mean that you need to send someone a file or just a message. If you want to send an entire file, see : man nail.
 
Old 03-09-2005, 04:26 AM   #4
RomanG
Member
 
Registered: Jan 2005
Location: Russia, Kazan
Distribution: Mandrake 10.2, RedHat sometimes..
Posts: 110

Original Poster
Rep: Reputation: 15
sorry, i didn't find nail on my system..
and you are right, i need not to type text, but use a prepared text file for it.
 
Old 03-09-2005, 06:35 AM   #5
drumvudu
Member
 
Registered: Jul 2004
Location: Houston, Texas USA
Distribution: Linux Mint
Posts: 57

Rep: Reputation: 15
Nail is a tiny program, why not just install it and save yourself allot of grief? If you give a 'man mail' does the manual page for mail or nail come up? /peter
 
Old 03-09-2005, 11:33 AM   #6
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
Re: sending mail via CLI

Quote:
Originally posted by RomanG
hello all!
i need to send a mail (one text file) from command line using sendmail. and also i do not want sendmail to stop and ask me to type a recipient or smth. else. i think this would look like "cat somefile.txt > sendmail 'and some options (recipient at least) i don't know' " what options should i use?
Try:
Code:
cat somefile.txt | mail -s "subject goes here" somename@somewhere.com
-- or --
Code:
mail -s "subject goes here" somename@somewhere.com < somefile.txt
Do not use "cat somefile.txt > sendmail" That will just create a file named "sendmail".
 
Old 03-09-2005, 11:06 PM   #7
RomanG
Member
 
Registered: Jan 2005
Location: Russia, Kazan
Distribution: Mandrake 10.2, RedHat sometimes..
Posts: 110

Original Poster
Rep: Reputation: 15
Many thanks to you wpn146. You helped a lot.
* Sometimes Google can't help, because I even don't know, the way/direction to search in..
Thank you again.
 
  


Reply



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
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
Cron mail sending using outside SMTP mail server Utah Linux - Software 6 08-24-2005 07:44 PM
mail --- cli Thrasher Linux - Software 3 03-19-2004 09:47 PM
Sending an automatic mail using bash + mail Minuteman Linux - Software 4 08-21-2003 12:49 PM
sending mail via cli Chijtska Linux - Networking 14 02-03-2002 08:48 AM

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

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