Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 09-21-2008, 09:15 AM   #1
Registered: Aug 2008
Location: Southern Maryland
Distribution: ubuntu 14.04 LTS
Posts: 112

Rep: Reputation: 1
Cool using mail form the command line

I am trying to better understand how email works under Linux and to use mail from the command line.
I don't know why I want to do this, I just do. I guess it would be convenient in a way.
My Unix books simply tell me how to use the "mail" program.
I have since learned that I probably need to configure my MTA (mail transfer agent) which is Postfix.
Postfix is installed with my OpenSuse distro. I can see my /etc/postfix/ file.
Many of the lines are commented out with a "#", such as #myhostname = host.domain.tld, #myhostname = virtual.domain.tld, #mydomain = domain.tld, #inet_interfaces = all.
I suppose these lines need to be uncommented in order for me to use mail from the command line.
And they probablay need to be edited to fit my needs.
1) I would like any basic suggestions on configuring this file.
2) Also, if and when I get mail to work on the command line, is it safe? I understand mail to be a filterless program, so any spam or virus might get thru and opened if I'm not careful.
Old 09-22-2008, 01:58 AM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
Yes, you are correct - you need an MTA to have mail actually transferred.

The commented out lines are comments to help show you a) defaults and/or b) examples. Add similar values as appropriate for your site needs.

Start by reading:

The mail command is safe. The mail command uses the sendmail binary, which ultimately just drops the mail into the postfix mail queue. Postfix then handles delivery. Any filtering/antivirus scans you want to perform would be configured in Postfix. Since sendmail uses a different entrance path into Postfix, there are other controls that can be tuned, but you can get into that later.
Old 09-27-2008, 04:29 AM   #3
Registered: Aug 2008
Location: Southern Maryland
Distribution: ubuntu 14.04 LTS
Posts: 112

Original Poster
Rep: Reputation: 1

Woah. They don't dumb it down do they? I am looking for simple steps to configure this file and my computer so I can use mail. The documentation isn't very clear. I would think somewhere in there I'd have to put my email address. I have a dynamic ip address so I guess I don't have a real internet hostname. The example at isn't very clear to me.
Old 09-27-2008, 04:45 AM   #4
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
You can't dumb it down too much - running a mail server is serious business - get it wong and you're another spam rely.

What are you finding so hard about the postfix docs?
Old 09-27-2008, 05:30 AM   #5
Registered: Mar 2008
Location: India
Distribution: RHEL5
Posts: 34

Rep: Reputation: 15
To configura a mail server involves following steps:
(a) Getting a domain name and the MX record for your domain on the DNS server points to the addresss of your mail server.
(b) Configure basic postfix setings (/etc/postfix/ Read the configuration file carefully. Add the following code at the end of the file
myhostname =
mydomain =
mydestination = $myhostname, $mydomain, localhost.$mydomain
(c) Now restart postfix with rcpostfix restart

Old 09-27-2008, 11:19 AM   #6
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
The distros do the dumbing-down, but providing installation wizards that help configure some of the basic settings.

The postfix documentation is clear and precise, but like all documentation, must make some assumptions about the existing and prerequisite knowledge of its audience. The postfix documentation assumes minimally an understanding of SMTP mail terminology and some of the protocol.

There are multiple How To recipes in existence routinely referenced by others. Find one that's suitable for your distribution's particularities.

Of course, the better solution is always to gain an understanding of the software and services you install, as installation is the cheap and easy part - maintenance, troubleshooting, and tuning are the real expenses.

With a dynamic IP, you will have some difficulties running a mail server, as a large portion of remote MTAs will not accept email from dynamic or residential IPs.

You asked if the mail command line was safe. Perhaps the more important question is "can you safely run an MTA?"


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
Command line arguments -- what form are they? bioinformatics_guy Linux - Newbie 8 09-12-2008 08:16 AM
Submit web form from command line? dbc001 Linux - Networking 2 10-15-2006 03:59 AM
shell script works form command line but not form crontab saifee General 1 10-14-2004 10:27 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 06:40 PM
instant message form command line jonfa Linux - General 4 03-10-2004 09:45 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:30 PM.

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