Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-29-2004, 07:02 PM   #1
Registered: Aug 2004
Posts: 88

Rep: Reputation: 15
using "mail" program

I did a locate mailto on my Red Hat box, but found nothing. However, I have mail...I'd like use "mail" to send an email to myself from the command line. Is this possible? In other words, when you just install a recent Red Hat distro, does it come with the ability to go to the command line and type a simple string that will send an email to someone? Or do you always have to go through some major installation/configuration of sendmail or something like that?

Last edited by naijaguy; 12-29-2004 at 07:16 PM.
Old 12-29-2004, 07:31 PM   #2
Registered: Aug 2004
Distribution: debian, SuSE
Posts: 365

Rep: Reputation: 35
A lot will depend on whether you are sending it to a user on the host machine, or out to the world. Usually, you need either a mail server set up, or to use something like pop3

However, for your question.

mail [username] is the syntax

example: mail joe

You will be prompted for a subject.

Yoiu can specify the subject right from the start also such as
mail -s "Some mail for you"

You can also send the contents of a file as well.

mail -s "A message for you" <some_file_name
Old 12-29-2004, 07:42 PM   #3
Registered: Aug 2004
Posts: 88

Original Poster
Rep: Reputation: 15
Ah...I want to send it out to the world. That's much harder to get set up, isn't it?
Old 12-30-2004, 03:00 AM   #4
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
As long as your nameservers are setup appropriately and that you have sendmail running then yes, you can send mail out to the world

Old 12-30-2004, 05:28 AM   #5
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Originally posted by twantrd
As long as your nameservers are setup appropriately and that you have sendmail running then yes, you can send mail out to the world

Although this is known as 'Spam'
Old 12-30-2004, 09:48 AM   #6
Registered: Aug 2004
Posts: 88

Original Poster
Rep: Reputation: 15
I know the chances of you believing me are not that great, but these emails are sent to our customers for shipment notifications. I need to be able to do non-text attachments for some of them because occasionally our customers will actually email a shipment label to someone. I have seen some code before for doing a binary attachment using Java, but it's a bit complicated. I would rather not install JavaMail for this one special case.

On Windows, our web app would use the Blat command line utility to send an email with an attachment. However, it seems like there's nothing that simple on Linux, or maybe I'm missing something...when I send an email with either Blat or Java code, I just connect to our ISP's SMTP server by setting it as the host, and then I can email all day long. I've tried to figure out how to do this with mutt or mail or something like that, but it seems like in order to do that I have to have a sendmail server running. But maybe I'm wrong--maybe mutt can run as long as you tell it what the SMTP server is (I just haven't figured out where to configure that).

When I try to send an email with mutt from the command line, it doesn't tell me there's an error, but I also never get the email...



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
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
Qmail problem: ISP mail and virtual mail, "sorry no mailbox, here by that user" barryw Linux - Networking 7 05-28-2005 12:43 PM
C -communicating with system("ftp"); using "program|ftp>>myfifo" probably hansschmucker Programming 1 03-23-2005 01:39 PM
Getting error: "ALSA device "default" is already in use by another program." brynjarh Debian 7 02-04-2005 11:45 AM
"mail" and "mailx" lost. yapp Slackware 2 10-27-2003 11:35 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:49 AM.

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