Debian 9 Stretch
Sponsored Link

Add Mail Accounts#12017/06/28

Add Mail User Accounts to use Mail Service.
This example is for the case you use OS user accounts.
Configure basic Postfix settings, and basic Dovecot settings first.
[1] To use OS user accounts, that's only adding OS user like follows.
# install mail client

apt -y install mailutils
# set environment variables to use Maildir

echo 'export MAIL=$HOME/Maildir' >> /etc/profile
# add a user [debian]

adduser debian

Adding user `debian' ...
Adding new group `debian' (1001) ...
Adding new user `debian' (1001) with group `debian' ...
Creating home directory `/home/debian' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:    
# set password

Retype new UNIX password:    
# confirm

passwd: password updated successfully
Changing the user information for debian
Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
Is the information correct? [Y/n]

[2] Login as a user added in [1] and try to send an email.
# send to myself [mail (username)@(hostname)]

mail debian@localhost

# specify [CC] (if not need, simply Enter)
# input subject
Subject: Test Mail#1
# input messages
This is the first mail.

# to finish messages, push [Ctrl+D]

# see received emails


"/home/debian/Maildir": 2 messages 2 unread
>U   1 Server World                      20/723   Test Mail #5
 U   2 debian                              20/674   Test Mail#1

# input the number you'd like to see an email
? 2
Return-Path: <>
X-Original-To: debian@localhost
Delivered-To: debian@localhost
Received: from (localhost [])
        by (Postfix) with ESMTP id EA44515F32C
        for <debian@localhost>; Thu, 29 Jun 2017 19:26:23 +0900 (JST)
Received: by (Postfix, from userid 1001)
        id C5D5915F385; Thu, 29 Jun 2017 19:26:23 +0900 (JST)
To: <debian@localhost>
Subject: Test Mail#1
X-Mailer: mail (GNU Mailutils 3.1.1)
Message-Id: <>
Date: Thu, 29 Jun 2017 19:26:23 +0900 (JST)
From: (debian)

# to quit, input [q]
? q
Saved 1 message in /home/debian/mbox
Held 1 message in /home/debian/Maildir
Matched Content