sudo yum -y install fetchmail sendmail postfix


poll mail.kisti.re.kr protocol IMAP
   user "gdhong@kisti.re.kr" is gdhong here
   password 'PASSWORD'
   folder 'INBOX'
   fetchlimit 1
   keep
   ssl


$ chmod 600 ~/.fetchmailrc

$ cat /dev/null > /var/spool/mail/gdhong

$ wc -l /var/spool/mail/gdhong
0

$ fetchmail
1 message for gdhong@kisti.re.kr at mail.kisti.re.kr (folder INBOX).
reading message gdhong@kisti.re.kr@mail.kisti.re.kr:1 of 1 (2660 header octets) (228 body octets) not flushed

$ wc -l /var/spool/mail/gdhong
67 /var/spool/mail/gdhong

$ fetchmail
1 message (1 seen) for gdhong@kisti.re.kr at mail.kisti.re.kr (folder INBOX).

$ wc -l /var/spool/mail/gdhong
67 /var/spool/mail/gdhong


From gdhong@gmail.com  Wed Jun  9 16:43:51 2021
Return-Path: <gdhong@gmail.com>
X-Original-To: gdhong@localhost
Delivered-To: gdhong@localhost.localdomain
Received: from localhost (localhost [IPv6:::1])
	by ws.localdomain (Postfix) with ESMTP id D8C7137410FE
	for <gdhong@localhost>; Wed,  9 Jun 2021 16:43:50 +0900 (KST)
Received: from mail.kisti.re.kr [XXX.YYY.93.20]
	by localhost with IMAP (fetchmail-6.3.24)
	for <gdhong@localhost> (single-drop); Wed, 09 Jun 2021 16:43:50 +0900 (KST)
Received: from gmail.com (XXX.YYY.93.20)
	by localhost with ESMTP imoxion SensMail SmtpServer 10.0
	id <2ee5ee71e4f649a6964f25d36c551563> for <gdhong@kisti.re.kr> from <gdhong@gmail.com>
	(version=TLSv1.2 cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA);
	Wed, 09 Jun 2021 16:47:12 +0900
Received: from unknown (HELO mail-ed1-f41.google.com) (209.85.208.41)
	by XXX.YYY.93.12 with ESMTP; 9 Jun 2021 16:47:20 +0900
X-Original-SENDERIP: XXX.YYY.208.41
X-Original-MAILFROM: gdhong@gmail.com
Received: by mail-ed1-f41.google.com with SMTP id s6so27607124edu.10
        for <gdhong@kisti.re.kr>; Wed, 09 Jun 2021 00:47:11 -0700 (PDT)
...
MIME-Version: 1.0
From: =?UTF-8?B?TWluc2VvayBKYW5nKOyepeuvvOyEnSk=?= <gdhong@gmail.com>
Date: Wed, 9 Jun 2021 16:46:56 +0900
Message-ID: <CAJsGQ7ZC0YkdX8=96DbvN3sSMWhi+GHFjGq1yUDCCKHKNdeRVA@mail.gmail.com>
Subject: Hello
To: =?UTF-8?B?7J6l66+87ISd?= <gdhong@kisti.re.kr>
Content-Type: multipart/alternative; boundary="0000000000003fba6d05c4507b8b"

--0000000000003fba6d05c4507b8b
Content-Type: text/plain; charset="UTF-8"

World

--0000000000003fba6d05c4507b8b
Content-Type: text/html; charset="UTF-8"

<div dir="ltr">World</div>

--0000000000003fba6d05c4507b8b--