Ask Your Question
1

local user mail

asked 2016-01-08 21:03:52 -0500

anlarye gravatar image

I'm looking for a tutorial or guidance on setting up mail for local users only. Where usera can send an email to userb via command line with mailx or use a GUI like Thunderbird. It seems there is no default system in place on Fedora 23 to do this task. So even cron jobs wont send emails to the users.

Searching on the internet results in a lot of confusion. Most places point to Postfix and sometimes Postfix with devcot. Which is necessary? Most config examples for main.cf on Postfix show how to setup email for sending over the internet but I'm not needing that functionality on this system.

Thank you for any help you can provide on this issue.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2016-01-09 16:00:52 -0500

Hello.

Sometime in past it has been decided that there will not be any MTA installed by default on Fedora Workstation (not sure about Fedora Server) that is why there are no email from cron anymore.

Postfix is needed to send emails, it is Mail Transport Agent (mail server). Dovecot is needed if you want to access mailboxes from GUI via IMAP (it is an IMAP server), i.e. with Thunderbird which does not support local delivery like Evolution does (to be honest I have not check if there is any plugin or extension for this).

Evolution let you access local mail files so it is not necessary to install Dovecot server if you choose to use Evolution as a GUI email client.


Simple guide for Postfix:

  • install postfix:
    sudo dnf install postfix
  • configure it to accept the mails from localhost only, edit /etc/postfix/main.cf and add/change the following, leave the rest as default:
    myhostname = <your_hostname>
    mydomain = localhost  #or your domain if you have some configured on a system
    myorigin = $mydomain
    inet_interfaces = localhost
    inet_protocols = ipv4
    mynetworks = 127.0.0.0/8
    
  • enable and start postfix:
    sudo systemctl enable postfix.service
    sudo systemctl start postfix.service
  • verify it is running and listening
    netstat -lt | grep smtp
    tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN
    Now you are able to send/receive emails with mailx, mutter, evolution (GUI).

Setup of Evolution to pickup local mails

  • open Evolution, if there is no email account configured yet, Welcome page will be prompted; if there are some, go to Preferences -> Mail Accounts and click to Add
  • Now the steps would be quite similar, on Identity set your Email Address to <user>@localhost, uncheck 'Look up mail server details based on email address' and click Next
  • on Receiving Email from Server Type dropdown menu select Standard Unix mbox spool file; and for Spool File browse to /var/spool/mail/<user>
  • on Sending Email from Server Type dropdown menu select Sendmail

The rest of the options are up to you but you can skip them. You are ready to send/receive emails from Evolution from your local system mailbox.

Email addresses will be <user>@localhost, so the test email from usera to userb would look like this (using mailx):

usera$ mail -s Test userb@localhost << EOF
Hello world!
EOF

Since everything is running on localhost, it is not necessary to enable anything on firewall.


For more information about the magic around mail server, go through postfix manual available on net. Let us know how it goes and come back in case of issues.

edit flag offensive delete link more

Comments

Setting up Postfix and just using the command line for testing, no GUI yet. I get this:

[chris@sithreborn ~]$ No configuration file found at /home/chris/.esmtprc or /etc/esmtprc No configuration file found at /home/chris/.esmtprc or /etc/esmtprc No configuration file found at /home/chris/.esmtprc or /etc/esmtprc No configuration file found at /home/chris/.esmtprc or /etc/esmtprc

anlarye gravatar imageanlarye ( 2016-01-09 17:18:47 -0500 )edit

Well, esmtp is another MTA. What was your settings of /etc/alternatives/mta? It is more likely that it has been pointing to esmtp instead of to postfix, since postfix does not need to have esmtp to be installed.

If you would like to go the way with postfix, be sure that sendmail binary (symlink) points, either via /etc/alternatives/mta, or directly to /usr/sbin/sendmail.postfix

kukacek gravatar imagekukacek ( 2016-01-10 02:05:52 -0500 )edit
0

answered 2016-01-09 23:03:37 -0500

anlarye gravatar image

I was able to solve the local email issue by removing Postfix. Then installing esmtp and procmail. creating an /etc/esmtprc file with the following info in it:

mda "/usr/bin/procmail -d %T"

Then creating a symlink for sendmail pointed to esmtp with:

ln -s /usr/bin/esmtp /usr/sbin/sendmail

This does enable me to send emails to local users. Thunderbird seems to be able to read them just fine as well. I found the instructions on Mozilla's website in accessing local *nix mailboxes.

I would still like to know why Postfix was looking for the esmtprc files though.

edit flag offensive delete link more

Comments

Looks like I spoke too soon. Root was able to send emails to other users with that setup but other users cannot send emails to other users or root. ::sigh:: so close yet still so far.

anlarye gravatar imageanlarye ( 2016-01-09 23:24:09 -0500 )edit

Unfortunately I do not have any experience with esmtp so I can not comment on this or guide you further to get this working also for the rest of the users (not only for root). Maybe someone else on this forum can.

kukacek gravatar imagekukacek ( 2016-01-10 02:08:12 -0500 )edit

I found out what was wrong with the above setup with esmtp/procmail for local mail delivery. procmail needs to run as root to send mail from other users. So the setuid needs to be on the /usr/bin/procmail. And then it works completely. Also Thuderbird doesn't have any way of sending emails using esmtp, it might work for Postfix. Would still like to know why that setup wasn't working.

anlarye gravatar imageanlarye ( 2016-01-10 12:43:33 -0500 )edit

I have commented about Postfix earlier, the comment is above, attached my Answer. Could you check that and let us know?

kukacek gravatar imagekukacek ( 2016-01-10 13:17:02 -0500 )edit

I did a fresh install and made sure it was pointed to Postfix. And it did work. Thank you very much.

anlarye gravatar imageanlarye ( 2016-01-11 17:13:45 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-01-08 21:03:52 -0500

Seen: 4,561 times

Last updated: Jan 09 '16