Email

Fetchmail 不使用指定的協議

  • July 12, 2021

我正在嘗試設置 fetchmail 以使用 pop3 從 gmail 下載一些郵件。如您所見,問題在於 fetchmail 而不是使用 pop 協議將使用 imap。

為了確保在配置過程中不犯任何錯誤,我將總結該過程:

  1. 我在 /etc/default 文件夾中編輯了名為“fetchmail”的文件,並將變數 demo 設置為“yes”;
  2. 現在我在文件夾 /etc 中創建了配置文件“fetchmailrc”。在這篇文章中,我寫道:
set postmaster "root"
set daemon 600

poll pop.gmail.com with proto POP3
   user 'insertEmailHere@gmail.com' there with password 'secretPWD' is root here options ssl
  1. 然後我繼續進行測試,看看它是否使用命令:“fetchmail -d0 -vk pop.gmail.com”。該命令的響應如下:
fetchmail: 6.4.2 querying pop.gmail.com (protocol auto) at Mon Jul 12 12:43:41 2021: poll started
fetchmail: 6.4.2 querying pop.gmail.com (protocol IMAP) at Mon Jul 12 12:43:41 2021: poll started
Trying to connect to 173.194.69.109/143...connection failed.
fetchmail: connection to pop.gmail.com:imap [173.194.69.109/143] failed: Connection timed out.
Trying to connect to 173.194.69.108/143...connection failed.
fetchmail: connection to pop.gmail.com:imap [173.194.69.108/143] failed: Connection timed out.
Trying to connect to 2a00:1450:4013:c00::6c/143...connection failed.
fetchmail: connection to pop.gmail.com:imap [2a00:1450:4013:c00::6c/143] failed: Network is unreachable.
Trying to connect to 2a00:1450:4013:c00::6d/143...connection failed.
fetchmail: connection to pop.gmail.com:imap [2a00:1450:4013:c00::6d/143] failed: Network is unreachable.
fetchmail: Connection errors for this poll:
name 0: connection to pop.gmail.com:imap [173.194.69.109/143] failed: Connection timed out.
name 1: connection to pop.gmail.com:imap [173.194.69.108/143] failed: Connection timed out.
name 2: connection to pop.gmail.com:imap [2a00:1450:4013:c00::6c/143] failed: Network is unreachable.
name 3: connection to pop.gmail.com:imap [2a00:1450:4013:c00::6d/143] failed: Network is unreachable.
IMAP connection to pop.gmail.com failed: Network is unreachable
fetchmail: 6.4.2 querying pop.gmail.com (protocol IMAP) at Mon Jul 12 12:48:02 2021: poll                         completed
fetchmail: 6.4.2 querying pop.gmail.com (protocol auto) at Mon Jul 12 12:48:02 2021: poll completed
fetchmail: Query status=2 (SOCKET)
fetchmail: normal termination, status 2

我可以假設,fetchmail 試圖強制 imap 協議而不是 pop。我完全不明白為什麼要這樣做。

也許我的低意識讓我錯過了一些東西。現在我正在開發最新版本的 Ubuntu 伺服器。非常感謝您的關注,我很抱歉我的英語不好。

PS我知道不鼓勵使用root帳戶,但現在我只做一些嘗試。當我了解如何配置 fetchmail 後,下一步是使用 postfix、dovecot 和 fetchmail 設置一個完整的郵件伺服器。另外,我已經知道 getmail 的存在以及他非常簡單的設置。但現在我想了解這個錯誤的原因。

當您從命令行執行 fetchmail 時,預設情況下它將使用該/.fetchmailrc文件而不是其他任何東西。

要手動測試文件夾 /etc 中的配置文件“fetchmailrc”,您需要使用 -f <pathname>or --fetchmailrc <pathname> 選項。

換句話說,用

fetchmail -d0 -vk --fetchmailrc /etc/fetchmailrc

引用自:https://serverfault.com/questions/1069351