Debian 9 Stretch
Sponsored Link

Add Mail Accounts#1
2017/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

root@mail:~#
apt -y install mailutils
# set environment variables to use Maildir

root@mail:~#
echo 'export MAIL=$HOME/Maildir' >> /etc/profile
# add a user [debian]

root@dlp:~#
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]
y

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

debian@mail:~$
mail debian@localhost

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

# to finish messages, push [Ctrl+D]

# see received emails

debian@mail:~$
mail

"/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: <debian@mail.srv.world>
X-Original-To: debian@localhost
Delivered-To: debian@localhost
Received: from mail.srv.world (localhost [127.0.0.1])
        by mail.srv.world (Postfix) with ESMTP id EA44515F32C
        for <debian@localhost>; Thu, 29 Jun 2017 19:26:23 +0900 (JST)
Received: by mail.srv.world (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: <20170629012623.C5D5915F385@mail.srv.world>
Date: Thu, 29 Jun 2017 19:26:23 +0900 (JST)
From: debian@mail.srv.world (debian)

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