§2024-04-30

After we did install the postfix as are SMTP server with ninimum setup, let's test what it could do.

install mailutils

alexlai@h2Jammy:~$ sudo apt install mailutils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
mailutils is already the newest version (1:3.14-1).
0 to upgrade, 0 to newly install, 0 to remove and 3 not to upgrade.

¶ Recieve Mail Test Summary, using telnet

From To Status(send to alexlai@h2jammy.yushei.net
h2jammy.yushei.net h2jammy.yushei.net OK
opi58G(192.168.2.? h2jammy.yushei.net OK
gmail.com h2jammy.yushei.net OK
icloud.com h2jammy.yushei.net OK

localnet is 192.168.0.0/16, h2jammy.yushei.net is at 59.126.118.193(192.168.48.248)


¶Testing Sending mail out Test Summary using mail command

From To Status(send to alexlai@h2jammy.yushei.net
h2jammy.yushei.net alexlai@yushei.me OK
h2jammy.yushei.net alexlai@munetaka.me OK, but warmed, this appears to be suspicious
h2jammy.yushei.net rai.sousuke@gmail.com 迷惑メール
h2jammy.yushei.net rai.sousuke@gmail.com Rjected

rejected message from gmail.com, Gmail requires all senders to authenticate with either SPF or DKIM.

Return-Path: <>
X-Original-To: alexlai@h2Jammy.yushei.net
Delivered-To: alexlai@h2Jammy.yushei.net
Received: by h2Jammy.yushei.net (Postfix)
        id 5CB6855632; Tue, 30 Apr 2024 18:14:24 +0800 (CST)
Date: Tue, 30 Apr 2024 18:14:24 +0800 (CST)
From: MAILER-DAEMON@h2Jammy.yushei.net (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: alexlai@h2Jammy.yushei.net
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="7E52E55633.1714472064/h2Jammy.yushei.net"
Content-Transfer-Encoding: 8bit
Message-Id: <20240430101424.5CB6855632@h2Jammy.yushei.net>

This is a MIME-encapsulated message.

--7E52E55633.1714472064/h2Jammy.yushei.net
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is the mail system at host h2jammy.yushei.net.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<rai.sousuke@gmail.com>: host gmail-smtp-in.l.google.com[64.233.188.26] said:
    550-5.7.26 This mail has been blocked because the sender is
    unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate with
    either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results:
    550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [h2jammy.yushei.net] with
    ip: [59.126.118.189] = did not pass 550-5.7.26  550-5.7.26  For
    instructions on setting up authentication, go to 550 5.7.26
    https://support.google.com/mail/answer/81126#authentication
    h190-20020a636cc7000000b00613a67d613csi3450835pgc.126 - gsmtp (in reply to
    end of DATA command)

--7E52E55633.1714472064/h2Jammy.yushei.net
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; h2Jammy.yushei.net
X-Postfix-Queue-ID: 7E52E55633
X-Postfix-Sender: rfc822; alexlai@h2Jammy.yushei.net
Arrival-Date: Tue, 30 Apr 2024 18:14:22 +0800 (CST)

Final-Recipient: rfc822; rai.sousuke@gmail.com
Original-Recipient: rfc822;rai.sousuke@gmail.com
Action: failed
Status: 5.7.26
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.26 This mail has been blocked because the sender
    is unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate
    with either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results:
    550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [h2jammy.yushei.net] with
    ip: [59.126.118.189] = did not pass 550-5.7.26  550-5.7.26  For
    instructions on setting up authentication, go to 550 5.7.26
    https://support.google.com/mail/answer/81126#authentication
    h190-20020a636cc7000000b00613a67d613csi3450835pgc.126 - gsmtp

--7E52E55633.1714472064/h2Jammy.yushei.net
Content-Description: Undelivered Message
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit

Return-Path: <alexlai@h2Jammy.yushei.net>
Received: by h2Jammy.yushei.net (Postfix, from userid 1026)
        id 7E52E55633; Tue, 30 Apr 2024 18:14:22 +0800 (CST)
Subject: Tesing senmail out
To: <rai.sousuke@gmail.com>
Cc: <alexlai@h2jammy.yushei.net>
User-Agent: mail (GNU Mailutils 3.14)
Date: Tue, 30 Apr 2024 18:14:22 +0800
Message-Id: <20240430101422.7E52E55633@h2Jammy.yushei.net>
From: AlexLai <alexlai@h2Jammy.yushei.net>

Time 2024-04-30 18:30
Hi
Bye
.
ctl-d to send
quit

--7E52E55633.1714472064/h2Jammy.yushei.net--

以下: Tesing h2Jammy.yushei.net receiving mail functionality

&testing with telnet inside h2jammy.yushei.net locally

aalexlai@h2Jammy:~$ mail
No mail for alexlai

alexlai@h2Jammy:~$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 h2Jammy.yushei.net ESMTP Postfix (Ubuntu)
EHLO yushei.net
250-h2Jammy.yushei.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING
MAIL FROM: alexlai@h2jammy.yushei.net
250 2.1.0 Ok
RCPT TO: alexlai@h2jammy.yushei.net
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: tesing SMTP server locallu 
time is 2024-04-30 14:08
Hi
Bue
.
250 2.0.0 Ok: queued as 5F91855632
quit
221 2.0.0 Bye
Connection closed by foreign host.
You have new mail in /home/alexlai/Maildir
alexlai@h2Jammy:~$ mail
"/home/alexlai/Maildir": 1 message 1 new
>N   1 alexlai@h2jammy.yu 二  四  30 06:  14/511   tesing SMTP server locallu
? 1
Return-Path: <alexlai@h2jammy.yushei.net>
X-Original-To: alexlai@h2jammy.yushei.net
Delivered-To: alexlai@h2jammy.yushei.net
Received: from yushei.net (localhost [127.0.0.1])
	by h2Jammy.yushei.net (Postfix) with ESMTP id 5F91855632
	for <alexlai@h2jammy.yushei.net>; Tue, 30 Apr 2024 14:07:05 +0800 (CST)
Subject: tesing SMTP server locallu
Message-Id: <20240430060728.5F91855632@h2Jammy.yushei.net>
Date: Tue, 30 Apr 2024 14:07:05 +0800 (CST)
From: alexlai@h2jammy.yushei.net

time is 2024-04-30 14:08
Hi
Bue
? 

¶ testing from 192.168.0.0/16

alexlai@opi58G:~$ telnet h2jammy.yushei.net 25
Trying 59.126.118.193...
Connected to h2jammy.yushei.net.
Escape character is '^]'.
220 h2Jammy.yushei.net ESMTP Postfix (Ubuntu)
EHLO yushei.net
250-h2Jammy.yushei.net
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-DSN
250-SMTPUTF8
250 CHUNKING
MAIL FROM:opi58g.yushei.net
250 2.1.0 Ok
RCPT TO: alexlai@h2jammy.yushei.net
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Testing SMTP from 192.168.2.133         
Time 2024-04-30 14:15
Hi
Bye
.
250 2.0.0 Ok: queued as 0CF1A55632
quit
221 2.0.0 Bye
Connection closed by foreign host.
alexlai@h2Jammy:~$ mail
"/home/alexlai/Maildir": 1 message 1 new
>N   1                    二  四  30 06:  11/418   Testing SMTP from 192.168.2.133
? d
?

h2jammy.yushei.net has the followings setup alreaduy

1. for spf, just have a txt record with your DNS 
- "v=spf1 include:_spf.google.com mx a:h2Jammy.yushei.net ~all"
2. dkim
"v=DKIM1;h=sha256;k=rsa;t=y;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxA2IAxLyotkJGq9XaoIJF1f3lcYWZRHnNxl671GPHCIh7XYTgp5LMOUWbXaODht7yAmOCBRpL8bHur+fD0bs7YGx/wJ7hI4lmsOBx6OoFyHJMmR9e4ABcBTskpOnVOuJtMhX0Jn375BJzyXIQE40mTvQgX0zmZgY0KjA20tLV/GywvCTINonJBZfDK1RLB1FIxITZhmy+4B4mLNjGVdus0MNaoHhcR0VE0Ahmdys6DZ4M/H4aEhNY9Kdfkm6EZ3hIZ2+945M3L/FO+Nn+/R/tAKXq+oLzHNM49XxEj0JQnI3eaaVwQqKsUUIrbDNLmM909Yx1IK/Rgk19lT5AgnNjQIDAQAB"

¶ Testing from gmail, send out a message

alexlai@h2Jammy:~$ mail
"/home/alexlai/Maildir": 1 message 1 new
>N   1 頼宗佑          二  四  30 06:  58/3030  Testing h2jammy.yushei.net SMTP set up
? 1
Return-Path: <rai.sousuke@gmail.com>
X-Original-To: alexlai@h2jammy.yushei.net
Delivered-To: alexlai@h2jammy.yushei.net
Received: from mail-io1-f42.google.com (mail-io1-f42.google.com [209.85.166.42])
	by h2Jammy.yushei.net (Postfix) with ESMTPS id 8F4A055632
	for <alexlai@h2jammy.yushei.net>; Tue, 30 Apr 2024 14:33:53 +0800 (CST)
Received: by mail-io1-f42.google.com with SMTP id ca18e2360f4ac-7dbc33bdf08so226211039f.1
        for <alexlai@h2jammy.yushei.net>; Mon, 29 Apr 2024 23:33:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1714458831; x=1715063631; darn=h2jammy.yushei.net;
        h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
         :date:message-id:reply-to;
        bh=X2YPCsSjjGbShyTP4OUciT5MFJKU9p5NvALnU+HL4r4=;
        b=cqpcgREjxQ8yNlo9/jDxdFRVka48ciHEuuWOFl/+m3r6Mm10NaVDsEQxHI5fIpmAKG
         kJWlsv3TzCrz2ASqcXTj+kh6oEQmvu3nMzr1EtgCkxn5ozK6qEWRbaRI8Pc1d6IyJUN/
         cdspSUjDfLycFIgnZkkQzLoBGjGOkNCyhCI5lMp6wFDm4mfmPHAIQpkY9v3BF0YF9uqr
         xg63vXXxw5sH2h4j7ZU8O1DgzbXPcukNPy+k4Y9GE92ApulDpP3f4y2pJ6gU7I1WJGk2
         gEZuD8mReG8walgTNLP1f3EZxP+hz5aAizyARswRjJgtV/9YrN8+7360gIkQTZnrvHs2
         wRZw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1714458831; x=1715063631;
        h=to:subject:message-id:date:from:mime-version:x-gm-message-state
         :from:to:cc:subject:date:message-id:reply-to;
        bh=X2YPCsSjjGbShyTP4OUciT5MFJKU9p5NvALnU+HL4r4=;
        b=A4fK7iH3AaIHQSURk49T8oYFwMi+nbRlwxIcdh6VrvwMoe87Vkw22MQ1SeaLrfe/1a
         MgFRewMZBTyJXML7KA1Ywq+XdHp3R5LYT7smoz7Pb8tD6hHA+xad6LVkXxRZIctghQik
         YQFJFz+POQea7z36u6U5NrJFjo767bFJaaoRLxulbBF2W019zTLT0gTYfQeRb5G1gvwP
         lI+tWpGaQc+ykAN7xBh7B3dH4uR1sCYXuYho2x9DVImePCp+u8x2zDjNaZxkYxgmSuFY
         5bBSdcZxG0950NMeioinfT6hLEEAePU4sWVlWG2d+PCHvdjd8Gmy/69sHAqLEWYXc6h0
         2S/g==
X-Gm-Message-State: AOJu0YwEAEUx9OrKZVq7CGKMg/NCPBkuDW4bywNG0wi402TZDalfLzVx
	poxhvCDBbBVAqLcr9nupD1/dB9uesSPqHmOXOIeZTQ+Pc23P4+whq38luMhur9bY97mtfkq8aXk
	ZwdUO9jNGiK8skdLRdsr2xAqirt5F
X-Google-Smtp-Source: AGHT+IGp6LW8KMyIXpX7PZUtD2lpH99e+Q+pIJ7doeWA75Pilz+FRUCic+mZBgPfrW1tCI8ZxIdZuyt0hWt1iP0UPp0=
X-Received: by 2002:a05:6e02:1d84:b0:36b:3c9c:5599 with SMTP id
 h4-20020a056e021d8400b0036b3c9c5599mr12224430ila.0.1714458831590; Mon, 29 Apr
 2024 23:33:51 -0700 (PDT)
MIME-Version: 1.0
From: 頼宗佑 <rai.sousuke@gmail.com>
Date: Tue, 30 Apr 2024 14:33:40 +0800
Message-ID: <CAO83_PUKvH6+fjrHxacZ8s+srcRL+_Oe2BhHCVsnzSdBZCQYTQ@mail.gmail.com>
Subject: Testing h2jammy.yushei.net SMTP set up
To: alexlai@h2jammy.yushei.net
Content-Type: multipart/alternative; boundary="000000000000a39fb306174a8dae"

--000000000000a39fb306174a8dae
Content-Type: text/plain; charset="UTF-8"

Time 2024-04-30 14:33
Hi
Bye

--000000000000a39fb306174a8dae
Content-Type: text/html; charset="UTF-8"

<div dir="ltr">Time 2024-04-30 14:33<div>Hi</div><div>Bye</div></div>

--000000000000a39fb306174a8dae--
? q
Saved 1 message in /home/alexlai/mbox
Held 0 messages in /home/alexlai/Maildir

¶ send out from icloud.com

alexlai@h2Jammy:~$ mail
"/home/alexlai/Maildir": 1 message 1 new
>N   1 Tsung-yiu Lai      二  四  30 06:  66/3270  Tesing h2Jammy.yushei.net SMTP setup
? 1
Return-Path: <rai.sousuke@icloud.com>
X-Original-To: alexlai@h2jammy.yushei.net
Delivered-To: alexlai@h2jammy.yushei.net
Received: from ci74p00im-qukt09090302.me.com (ci74p00im-qukt09090302.me.com [17.57.156.21])
	by h2Jammy.yushei.net (Postfix) with ESMTPS id E847E55632
	for <alexlai@h2jammy.yushei.net>; Tue, 30 Apr 2024 14:40:13 +0800 (CST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com;
	s=1a1hai; t=1714459212;
	bh=gFfBXf2BPobzIWP/i/vs6Sbw/YVyymI9/mqc0pqB+sA=;
	h=To:From:Subject:Date:Message-id:Content-Type:MIME-Version;
	b=MH6oEz3Gxt8UoaQR84FB3m58QUvkfAMp9kHbRuKdkiHstm6Lc9ZfNNcdi7sEzdPla
	 mCsn/Dj+vEw6Y91Ne+ooqpMugSAr6kXVYxDZPZqnvwjUIx3VNXymwu0kRmepHv2wyY
	 65LFsFb1ZRKIxPd/FXgD+/E9od1snOUr0Qh46+Y+ISFhdNqFdk1xihRQAtDYwa3PFL
	 msD0+RL67PW4iJYV6eeHfvDa703uIkvLFGkM4jAjKezrrKyrOCKVndWy8L/eY6zwwF
	 4kLn1UiqPTpTmJqqXdn2UInMtrkdsjq2DpbKsk+QVVvnR4Hceb4bHwie9gNd8llv47
	 0Hk7Ps3wtDtug==
Received: from ci74p00im-qukt09090302.me.com (unknown [17.57.156.21])
	by ci74p00im-qukt09090302.me.com (Postfix) with ESMTPS id 7E59D5BC00C1
	for <alexlai@h2jammy.yushei.net>; Tue, 30 Apr 2024 06:40:11 +0000 (UTC)
Received: from p00-mailws2-74549b55d8-64d4k (ci77p00im.dlb-asmtpoutvip.me.com [10.168.160.28])
	by ci74p00im-qukt09090302.me.com (Postfix) with ESMTPSA id 1D4AF5BC00B5
	for <alexlai@h2jammy.yushei.net>; Tue, 30 Apr 2024 06:40:11 +0000 (UTC)
To: "alexlai@h2jammy.yushei.net" <alexlai@h2jammy.yushei.net>
From: Tsung-yiu Lai <rai.sousuke@icloud.com>
Subject: Tesing h2Jammy.yushei.net SMTP setup
Date: Tue, 30 Apr 2024 06:40:11 +0000 (UTC)
X-Mailer: iCloud MailClientcurrent MailServer2409B72.10000-master-0-9980a4f196b0
Message-id: <3031344b-fd45-4860-95f8-4a909890b99a@me.com>
Content-Type: multipart/alternative; boundary=Apple-Webmail-42--fcf19752-b675-44b7-8166-bd25fff85893
MIME-Version: 1.0
X-Proofpoint-GUID: qvNSFyoiUyAMczGP3bxCXdu82F0OVBEM
X-Proofpoint-ORIG-GUID: qvNSFyoiUyAMczGP3bxCXdu82F0OVBEM
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26
 definitions=2024-04-30_02,2024-04-29_01,2023-05-22_02
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxscore=0 spamscore=0
 mlxlogscore=424 bulkscore=0 adultscore=0 suspectscore=0 phishscore=0
 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.19.0-2308100000 definitions=main-2404300047


--Apple-Webmail-42--fcf19752-b675-44b7-8166-bd25fff85893
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=utf-8;
    format=flowed

time 2024-04-30 14:39 Hi Bue Sent from iCloud
--Apple-Webmail-42--fcf19752-b675-44b7-8166-bd25fff85893
Content-Type: multipart/related;
    type="text/html";
    boundary=Apple-Webmail-86--fcf19752-b675-44b7-8166-bd25fff85893


--Apple-Webmail-86--fcf19752-b675-44b7-8166-bd25fff85893
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
    charset=utf-8;

<html><body><div><div>time 2024-04-30 14:39<br></div><div>Hi<br></div><div>Bue</div><d=
iv class=3D"x-apple-signature" style=3D"white-space: pre-wrap">Sent from i=
Cloud<br></div><div><br></div></div></body></html>
--Apple-Webmail-86--fcf19752-b675-44b7-8166-bd25fff85893--

--Apple-Webmail-42--fcf19752-b675-44b7-8166-bd25fff85893--

¶ test

alexlai@h2Jammy:~/opendkim$ mail -s "from h2jammy.yushei.net to outside" rai.sousuke@gmail.com, rai.sousuke@mac.com
Cc: alexlai@h2jammy.yushei.net
Time is 2024-04-30 19:28
Hi
Bue
.
quit < ctl-d to send it

¶ Using mail command to sendout mails Test

alexlai@h2Jammy:~$ mail -s "Tesing senmail out " rai.sousuke@gmail.com, rai.sousuke@mac.com, alexlai@yushei.me, alexlai@munetaka.me, jinwinlin@hotmail.com
Cc: alexlai@h2jammy.yushei.net
Subject: using mail command to sendout mail fom h2jammy.yushei.net
Time is 2024-04-30 18:00
Hi
Bye
.
ctl-d to send
quit

after quit then ctl-d to send mail out.


alexlai@h2Jammy:~$ mail -s "testing simple mail" alexlai@h2jammy.yushei.net
Cc: alexlai@yushei.me, alexlai@munetaka.me, rai.sousuke@mac.com, rai.sousuke@gmail.com
Subject: Freshly setup postfix to see how far it will sendmail
Time is 2024-04-24 14:50 
Hi
Bye
.
Apr 27 14:50:46 h2Jammy postfix/pickup[13076]: CEDF040191261: uid=1026 from=<alexlai@h2Jammy.yushei.net>
Apr 27 14:50:46 h2Jammy postfix/cleanup[13149]: CEDF040191261: message-id=<20240427065046.CEDF040191261@h2Jammy.yushei.net>
Apr 27 14:50:46 h2Jammy postfix/qmgr[13077]: CEDF040191261: from=<alexlai@h2Jammy.yushei.net>, size=566, nrcpt=5 (queue active)
Apr 27 14:50:46 h2Jammy postfix/local[13152]: CEDF040191261: to=<alexlai@h2jammy.yushei.net>, relay=local, delay=0.04, delays=0.03/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Apr 27 14:50:47 h2Jammy postfix/smtp[13151]: connect to gmail-smtp-in.l.google.com[2404:6800:4008:c04::1a]:25: Network is unreachable
Apr 27 14:50:48 h2Jammy postfix/smtp[13155]: CEDF040191261: to=<alexlai@yushei.me>, relay=mail.yushei.me[210.242.152.235]:25, delay=1.4, delays=0.03/0.08/0.86/0.44, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 1A27B11E342A)
Apr 27 14:50:48 h2Jammy postfix/smtp[13151]: CEDF040191261: to=<rai.sousuke@gmail.com>, relay=gmail-smtp-in.l.google.com[74.125.203.26]:25, delay=2, delays=0.03/0.02/1/0.87, dsn=5.7.26, status=bounced (host gmail-smtp-in.l.google.com[74.125.203.26] said: 550-5.7.26 This mail has been blocked because the sender is unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate with either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results: 550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [h2jammy.yushei.net] with ip: [59.126.118.194] = did not pass 550-5.7.26  550-5.7.26  For instructions on setting up authentication, go to 550 5.7.26  https://support.google.com/mail/answer/81126#authentication k14-20020a170902c40e00b001e28a8a83d8si16872741plk.270 - gsmtp (in reply to end of DATA command))
Apr 27 14:50:51 h2Jammy postfix/smtp[13154]: CEDF040191261: to=<alexlai@munetaka.me>, relay=mail.munetaka.me[114.33.29.69]:25, delay=4.4, delays=0.03/0.06/0.75/3.5, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2E8724CF071)
Apr 27 14:50:54 h2Jammy postfix/smtp[13153]: CEDF040191261: to=<rai.sousuke@mac.com>, relay=mx3.mail.icloud.com[17.42.251.62]:25, delay=7.4, delays=0.03/0.04/2.5/4.8, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as CCC445FC00F0)
Apr 27 14:50:54 h2Jammy postfix/cleanup[13149]: 33AFD40117EF0: message-id=<20240427065054.33AFD40117EF0@h2Jammy.yushei.net>
Apr 27 14:50:54 h2Jammy postfix/bounce[13156]: CEDF040191261: sender non-delivery notification: 33AFD40117EF0
Apr 27 14:50:54 h2Jammy postfix/qmgr[13077]: 33AFD40117EF0: from=<>, size=3715, nrcpt=1 (queue active)
Apr 27 14:50:54 h2Jammy postfix/qmgr[13077]: CEDF040191261: removed
Apr 27 14:50:54 h2Jammy postfix/local[13152]: 33AFD40117EF0: to=<alexlai@h2Jammy.yushei.net>, relay=local, delay=0.01, delays=0/0/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Apr 27 14:50:54 h2Jammy postfix/qmgr[13077]: 33AFD40117EF0: removed
Apr 27 14:51:26 h2Jammy dovecot: pop3-login: Disconnected: Connection closed (no auth attempts in 1 secs): user=<>, rip=167.94.146.59, lip=192.168.16.248, TLS: Connection closed, session=<RV75cg4XRo+nXpI7>
Apr 27 14:51:28 h2Jammy dovecot: pop3-login: Disconnected: Disconnected: Too many bad commands (no auth attempts in 0 secs): user=<>, rip=167.94.146.59, lip=192.168.16.248, session=<gxsXcw4XaI+nXpI7>
Apr 27 14:51:30 h2Jammy dovecot: pop3-login: Disconnected: Disconnected: Too many bad commands (no auth attempts in 0 secs): user=<>, rip=167.94.146.59, lip=192.168.16.248, session=<lk01cw4XSpOnXpI7>
Apr 27 14:51:32 h2Jammy dovecot: pop3-login: Disconnected: Disconnected: Too many bad commands (no auth attempts in 1 secs): user=<>, rip=167.94.146.59, lip=192.168.16.248, session=</lxScw4XTpOnXpI7>
Apr 27 14:51:33 h2Jammy dovecot: pop3-login: Disconnected: Disconnected: Too many bad commands (no auth attempts in 0 secs): user=<>, rip=167.94.146.59, lip=192.168.16.248, session=<2H5vcw4XVJOnXpI7>

&SMTP authentication

SMTP-AUTH allows a client to identify itself through the Simple Authentication and Security Layer (SASL) authentication mechanism, using Transport Layer Security (TLS) to encrypt the authentication process. Once it has been authenticated, the SMTP server will allow the client to relay mail.

To enable SMTP authentication with Postfix, for instance, you would typically configure it to use Dovecot's authentication mechanisms. Using Dovecots' authentication mechanism, sudo apt-get install dovecot-core, but if you have installed dovecot-pop3d and dovecot-imapd, then dovecot-core is included.

Installing Dovecot's POP3 and IMAP components (dovecot-pop3d and dovecot-imapd) is necessary if you want to provide POP3 or IMAP access to your users to retrieve their emails.

¶Configure SMTP authentication

To configure Postfix for SMTP-AUTH using SASL (Dovecot SASL), run these commands at a terminal prompt:

Note: The smtpd_sasl_path config parameter is a path relative to the Postfix queue directory.

freshly installed main.cf

alexlai@h2Jammy:~$ grep sasl  /etc/postfix/main.cf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
alexlai@h2Jammy:~$ grep smtpd_recipient_restrictions  /etc/postfix/main.cf
sudo postconf -e 'smtpd_sasl_type = dovecot' && \
sudo postconf -e 'smtpd_sasl_path = private/auth' && \
sudo postconf -e 'smtpd_sasl_local_domain =' && \
sudo postconf -e 'smtpd_sasl_security_options = noanonymous,noplaintext' && \
sudo postconf -e 'smtpd_sasl_tls_security_options = noanonymous' && \
sudo postconf -e 'broken_sasl_auth_clients = yes' && \
sudo postconf -e 'smtpd_sasl_auth_enable = yes'  && \
sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination' 
alexlai@h2Jammy:~$ grep sasl  /etc/postfix/main.cf
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = 
smtpd_sasl_security_options = noanonymous,noplaintext
smtpd_sasl_tls_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

¶test SASL, make sure postfix is restarted and sucessfully

telnet localhost 25 EHLO example.com AUTH LOGIN

YWxleGxhaQ==
alexlai@h2Jammy:~$ echo -n "alex1765" | base64
YWxleDE3NjU=

alexlai@h2Jammy:$ sudo mkdir /var/spool/postfix/private/auth alexlai@h2Jammy:$ sudo chown postfix:postfix /var/spool/postfix/private/auth


&para; send mail out

alexlai@h2Jammy:~$ mail -s"testing sendmail using mail to rai.sousuke@gmail.com" rai.sousuke@gmail.com, rai.sousuke@mac.com, alexlai@yushei.me, alexlai@munetaka.me, jinwinlin@hotmail.com Cc: Time is 2024-04-30 15:35 Hi Bue Bye . quit quit

alexlai@h2Jammy:~$ mail -s"testing sendmail using mail to rai.sousuke@gmail.com" rai.sousuke@gmail.com, rai.sousuke@mac.com, alexlai@yushei.me, alexlai@munetaka.me, jinwinlin@hotmail.com Cc: Time 2024-04-30 15:38 Hi Bye . <----- CTL-d to send out


- could only sent to yushei.me, munetaka.me, but not gmail.com, icloud.com, or hotmail.com