【Handson】Creating simple email server - toge510/homelab GitHub Wiki
準備
dev1
/etc/hosts
192.168.11.11 mailtest1.test
192.168.11.12 mailtest2.test
Add user1
useradd user1
passwd user1
/etc/postfix/main.cf
myhostname = dev1.mailtest1.test
mydomain = mailtest1.test
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
masquerade_domains = mailtest1.test
smtp_host_lookup = native
postfix check
systemctl restart postfix
[root@dev1 ~]# sendmail [email protected]
To:[email protected]
From:[email protected]
Subject:test
test
.
[root@dev1 ~]# cat /home/user1/Maildir/new/1700727973.V801I200005bM117146.dev1
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: by dev1.mailtest1.test (Postfix, from userid 0)
id 18E8D400A4FE; Thu, 23 Nov 2023 08:26:13 +0000 (UTC)
To:[email protected]
From:[email protected]
Subject:test
Message-Id: <[email protected]>
Date: Thu, 23 Nov 2023 08:25:40 +0000 (UTC)
test
dev2
/etc/hosts
192.168.11.11 mailtest1.test
192.168.11.12 mailtest2.test
Add user2
useradd user2
passwd user2
/etc/postfix/main.cf
myhostname = dev2.mailtest2.test
mydomain = mailtest1.test
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
masquerade_domains = mailtest2.test
smtp_host_lookup = native
postfix check
systemctl restart postfix
[root@dev2 ~]# sendmail [email protected]
To:[email protected]
From:[email protected]
Subject:test
test
.
su - user2
[root@dev2 ~]# cat /home/user2/Maildir/new/1700728256.V801I2000058M158017.dev2\:2\,
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: by dev2.mailtest2.test (Postfix, from userid 0)
id 23C0A4074793; Thu, 23 Nov 2023 08:30:56 +0000 (UTC)
To:[email protected]
From:[email protected]
Subject:test
Message-Id: <[email protected]>
Date: Thu, 23 Nov 2023 08:30:23 +0000 (UTC)
test
[email protected] to [email protected]
Email fromIn dev1
[root@dev1 ~]# sendmail [email protected]
To:[email protected]
From:[email protected]
Subject:test
1 to 2
.
In dev2
[root@dev2 ~]# cat /home/user2/Maildir/new/1700729177.V801I2000054M290089.dev2\:2\,S
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from dev1.mailtest1.test (mailtest1.test [192.168.11.11])
by dev2.mailtest2.test (Postfix) with ESMTP id 44E154074793
for <[email protected]>; Thu, 23 Nov 2023 08:46:17 +0000 (UTC)
Received: by dev1.mailtest1.test (Postfix, from userid 0)
id 3CE6B400A04F; Thu, 23 Nov 2023 08:46:17 +0000 (UTC)
To:[email protected]
From:[email protected]
Subject:test
Message-Id: <[email protected]>
Date: Thu, 23 Nov 2023 08:45:58 +0000 (UTC)
1 to 2
既読、new,cur
Log
/var/log/maillog
dovecot
/etc/dovecot/dovecot.conf
protocols = imap pop3
listen = *, ::
/etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
/etc/dovecot/conf.d/10-auth.conf
/etc/dovecot/conf.d/10-auth.conf
/etc/dovecot/conf.d/10-ssl.conf
ssl = no
systemctl restart dovecot.service
[user2@dev2 ~]$ telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user user2
+OK
pass user2
+OK Logged in.
list
+OK 5 messages:
1 393
2 616
3 749
4 621
5 611
.
quit
メーラ ThunderBirdの設定
- | - |
---|---|
1 | 2 |
3 | 4 |
参考
メモ
- example.comが存在するため、そのドメインを/etc/hostsの前にDNSに探しにいったっぽい。。。よくわからない