Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
0
answers
63
views
No timestamps in fetchmail log
I am running fetchmail 6.6.62 on Raspberry Pi OS. The log is set to a logfile. The problem is, that the logfile does not have timestamps when a mail is retrieved. How can I set fetchmail to record the time the message is retrieved? The fetchmailrc file is the following: ``` set postmaster "foobar" s...
I am running fetchmail 6.6.62 on Raspberry Pi OS. The log is set to a logfile. The problem is, that the logfile does not have timestamps when a mail is retrieved. How can I set fetchmail to record the time the message is retrieved?
The fetchmailrc file is the following:
set postmaster "foobar"
set bouncemail
set no spambounce
set softbounce
set properties ""
set daemon 10
set logfile /home/foobar/fetchmail.log
poll imap.gmail.com with proto IMAP
user 'foo@gmail.com' there with password 'XXX' is 'foobar' here options fetchall nokeep idle ssl sslcertck
and the log looks like this:
fetchmail: 1 message for foo@gmail.com at imap.gmail.com.
fetchmail: reading message foo@gmail.com@imap.gmail.com:1 of 1 (4901 header octets) (741 body octets) flushed
fetchmail: 1 message for foo@gmail.com at imap.gmail.com.
fetchmail: reading message foo@gmail.com@imap.gmail.com:1 of 1 (5135 header octets) (1586 body octets) flushed
katonag
(23 rep)
Jan 23, 2025, 05:57 PM
1
votes
1
answers
105
views
Retrieve mails of only one specific account with fetchmail
## The situation I have the following `~/.fetchmailrc` ```fetchmailrc poll pop.gmail.com protocol pop3 user "foo@example.com" password "***" ssl mda "/usr/bin/procmail -d default -a foo@example-com" poll pop.gmail.com protocol pop3 user "bar@example.com" password "***" ssl mda "/usr/bin/procmail -d...
## The situation
I have the following
~/.fetchmailrc
poll pop.gmail.com protocol pop3 user "foo@example.com" password "***" ssl
mda "/usr/bin/procmail -d default -a foo@example-com"
poll pop.gmail.com protocol pop3 user "bar@example.com" password "***" ssl
mda "/usr/bin/procmail -d default -a bar@example-com"
So, I retrieve all the mails with fetchmail -v -m '/usr/bin/procmail -d %T'
.
## The problem
But the problem is all the accounts are retrieved.
## The question
Is it possible from fetchmail command to ask for retrieving just one specific addresses’ mails?
fauve
(1529 rep)
Mar 30, 2024, 01:06 PM
• Last activity: Apr 1, 2024, 08:33 AM
0
votes
1
answers
141
views
Where does fetchmail store e-mails?
Having removed procmail, am looking for where fetchmail is storing messages: nicholas@mordor:~$ nicholas@mordor:~$ tail -f /var/log/fetchmail.log fetchmail: IMAP A0004 SEARCH UNSEEN UNDELETED fetchmail: IMAP A0005 LOGOUT fetchmail: IMAP A0001 CAPABILITY fetchmail: IMAP A0002 LOGIN "saunders.nicholas...
Having removed procmail, am looking for where fetchmail is storing messages:
nicholas@mordor:~$
nicholas@mordor:~$ tail -f /var/log/fetchmail.log
fetchmail: IMAP A0004 SEARCH UNSEEN UNDELETED
fetchmail: IMAP A0005 LOGOUT
fetchmail: IMAP A0001 CAPABILITY
fetchmail: IMAP A0002 LOGIN "saunders.nicholas@gmail.com" *
fetchmail: IMAP A0003 SELECT "INBOX"
fetchmail: IMAP A0004 SEARCH UNSEEN UNDELETED
fetchmail: IMAP A0005 LOGOUT
fetchmail: IMAP< * BYE LOGOUT Requested
fetchmail: IMAP< A0005 OK 73 good day (Success)
fetchmail: 6.4.27 querying imap.gmail.com (protocol IMAP) at Sat 16 Dec 2023 10:31:35 AM: poll completed
fetchmail: sleeping at Sat 16 Dec 2023 10:31:35 AM for 600 seconds
nothing where expected:
nicholas@mordor:~$
nicholas@mordor:~$ ll /var/spool/mail/nicholas
-rw------- 1 nicholas mail 0 Nov 27 15:52 /var/spool/mail/nicholas
nicholas@mordor:~$
nicholas@mordor:~$ ll /var/mail/nicholas
-rw------- 1 nicholas mail 0 Nov 27 15:52 /var/mail/nicholas
nicholas@mordor:~$
As I'm using the Alpine e-mail client, there's some mail in my home directory under Mail, but none of the mbox files have recent activity to match the fetchmail activity.
Fetchmail configured as:
nicholas@mordor:~$
nicholas@mordor:~$ cat .fetchmailrc
set postmaster "saunders"
set daemon 60
set invisible
set postmaster administrator
set syslog
set logfile /var/log/fetchmail.log
set daemon 600
poll imap.gmail.com with proto IMAP
user 'saunders.nicholas@gmail.com' there with password 'xxx' is local_user here options ssl fetchlimit 1
keep
# folder "fetching"
nicholas@mordor:~$
where the fetchmail is limiting it's known where the mail's be stored.
It's correct to poll "imap.gmail.com"? Using the "app" password which Alpine uses as a work-around to 2FA. No password problems, just confirming configuration.
Can fetchmail be configured to explicitly use a particular directory or folder?
Nothing in "~/.fetchids" either.
Nothing listening on port 25.
log shows:
fetchmail: awakened by signal 10
fetchmail: restarting fetchmail (/home/nicholas/.fetchmailrc changed)
fetchmail: starting fetchmail 6.4.27 daemon
fetchmail: 31 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: 31 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: restarting fetchmail (/home/nicholas/.fetchmailrc changed)
fetchmail: starting fetchmail 6.4.27 daemon
fetchmail: 31 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: 31 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: awakened by signal 10
fetchmail: 32 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: reading message saunders.nicholas@gmail.com@imap.gmail.com:32 of 32 (613 header octets) (log message incomplete)
fetchmail: Connection errors for this poll:
name 0: connection to localhost:smtp [127.0.0.1/25] failed: Connection refused.
fetchmail: SMTP connect to localhost failed
fetchmail: SMTP transaction error while fetching from saunders.nicholas@gmail.com@imap.gmail.com and delivering to SMTP host localhost
fetchmail: Query status=10 (SMTP)
fetchmail: 32 messages (31 seen) for saunders.nicholas@gmail.com at imap.gmail.com.
fetchmail: reading message saunders.nicholas@gmail.com@imap.gmail.com:32 of 32 (613 header octets) (log message incomplete)
fetchmail: Connection errors for this poll:
name 0: connection to localhost:smtp [127.0.0.1/25] failed: Connection refused.
fetchmail: SMTP connect to localhost failed
fetchmail: SMTP transaction error while fetching from saunders.nicholas@gmail.com@imap.gmail.com and delivering to SMTP host localhost
fetchmail: Query status=10 (SMTP)
Just looking to grab a single message and store it locally. I can change the fetchmail configuration, but hesitate to start downloading too many e-mails until I figure out where the ones it did save are being stored.
nicholas@mordor:~$
nicholas@mordor:~$ telnet localhost 25
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
nicholas@mordor:~$
nicholas@mordor:~$ hostname -f
mordor.saundersconsulting.tech
nicholas@mordor:~$
nicholas@mordor:~$ telnet mordor.saundersconsulting.tech 25
Trying 127.0.1.1...
telnet: Unable to connect to remote host: Connection refused
nicholas@mordor:~$
Nicholas Saunders
(565 rep)
Dec 16, 2023, 06:42 PM
• Last activity: Dec 16, 2023, 09:03 PM
0
votes
1
answers
710
views
Fetchmail won't run as daemon
I have fetchmail set up to grab emails from a Google account. If I set fetchmailrc ownership to `root:root` and run `fetchmail -vvv --nodetach --nosyslog -f /etc/fetchmailrc`, it gets the emails as expected. If I set ownership to `fetchmail:root` and restart fetchmail then nothing happens. Permissio...
I have fetchmail set up to grab emails from a Google account. If I set fetchmailrc ownership to
root:root
and run fetchmail -vvv --nodetach --nosyslog -f /etc/fetchmailrc
, it gets the emails as expected. If I set ownership to fetchmail:root
and restart fetchmail then nothing happens. Permissions are 600. Here's my /etc/fetchmailrc:
set daemon 60
set invisible
set postmaster administrator
set no syslog
set logfile /var/log/fetchmail.log
poll pop.gmail.com protocol pop3 port 995 username "user@example.com" password "xxxxxx" ssl mda "/var/www/html/requesttracker/bin/rt-mailgate --queue YLN --action correspond --url https://subdomain.example.com " nokeep
How do I get the daemon to work?
**Update**: Further exploration has revealed that fetchmail isn't running. When I start fetchmail (systemctl start fetchmail
), it doesn't return any errors so I've thought it was running. A status returns this:
● fetchmail.service - A remote-mail retrieval utility
Loaded: loaded (/usr/lib/systemd/system/fetchmail.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2022-10-27 06:49:23 MST; 2s ago
Process: 51920 ExecStart=/usr/bin/fetchmail -d 300 --fetchmailrc /etc/fetchmailrc.example (code=exited, status=5)
Main PID: 51920 (code=exited, status=5)
Oct 27 06:49:23 ylntest.yln.info systemd: Started A remote-mail retrieval utility.
Oct 27 06:49:23 ylntest.yln.info systemd: fetchmail.service: Main process exited, code=exited, status=5/NOTINSTALL>
Oct 27 06:49:23 ylntest.yln.info systemd: fetchmail.service: Failed with result 'exit-code'.
Why does it fail? In particular, this line confuses me:
ExecStart=/usr/bin/fetchmail -d 300 --fetchmailrc /etc/fetchmailrc.example
. Why is trying to load the example file?
Chanel
(109 rep)
Oct 26, 2022, 03:07 PM
• Last activity: Oct 27, 2022, 02:17 PM
0
votes
1
answers
1244
views
How to use fetchmail with procmail (or maildrop) on a server running sendmail?
I have *Amazon Linux* instances in *AWS EC2*. They run `sendmail` to communicate with each other, and send outgoing mail through a SMARTHOST that is a commercial email provider. No MX records are pointing to my EC2 instances' public IP addresses, and no incoming mail ports are open. What I really wa...
I have *Amazon Linux* instances in *AWS EC2*. They run
sendmail
to communicate with each other, and send outgoing mail through a SMARTHOST that is a commercial email provider. No MX records are pointing to my EC2 instances' public IP addresses, and no incoming mail ports are open. What I really want is to have a commercial website (goformz.com) send a POST request with a PDF form to my website hosted on these instances
whenever a user submits a form. But until they figure out how to do that, I could work with their current behavior of having them email a PDF attachment to an address on the commercial email server.
After some head-scratching, it looks like I could probably get what I need by installing fetchmail
and either procmail
or maildrop
, no need to touch my sendmail
configuration. And that it "ought" to be very simple. I am familiar with **using** procmail
in a ~/.forward file as a **user**, but installing and configuring it on my EC2 servers is baffling to me after reading the documentation. It looks like both fetchmail
and procmail
want to run as daemons, and hand off messages to other servers. I expected that fetchmail
would run as a daemon, fetching messages from the commercial email account over IMAP at some frequency, and then **synchronously** invoke procmail
on each message, with a rule that was simply to pipe the message to a PHP script that would extract the attachment and process the form fields in it. It would be okay if the script invocation had to be in a ~/.forward file, I would hard-wire the user directory, but I don't see how to set that up. Can anyone set me straight on this, perhaps with just a pointer to documentation that would address this scenario?
I have found other answered questions that look similar, but none that have enlightened me. What I've found seems to assume that the server would be running postfix
as the MTA.
sootsnoot
(101 rep)
Oct 24, 2022, 04:28 PM
• Last activity: Oct 27, 2022, 04:52 AM
1
votes
0
answers
941
views
Fetchmail not writing to log
I'm setting up fetchmail for use with Request Tracker on a RHEL 8 server. It's not working and I'm unable to troubleshoot because it doesn't appear to be writing to `/var/log/syslog` or `/var/log/fetchmail.log`. How do I get it to write to one of these logs? Here's my `/etc/fetchmailrc`: ``` set dae...
I'm setting up fetchmail for use with Request Tracker on a RHEL 8 server. It's not working and I'm unable to troubleshoot because it doesn't appear to be writing to
/var/log/syslog
or /var/log/fetchmail.log
. How do I get it to write to one of these logs?
Here's my /etc/fetchmailrc
:
set daemon 60
set invisible
set postmaster administrator
set syslog
set logfile /var/log/fetchmail.log
poll pop.gmail.com protocol pop3 port 995 username "user@example.com" password "xxxxxx" ssl mda "/var/www/html/requesttracker/bin/rt-mailgate --queue YLN --action correspond --url https://subdomain.example.com " nokeep
I restart fetchmail after each fetchmailrc edit. What am I doing wrong?
**Update**: I tried this (I had already touched fetchmail.log with root:root access) and restarted fetchmail:
set daemon 60
set invisible
set postmaster administrator
set logfile /var/log/fetchmail.log
poll pop.gmail.com protocol pop3 port 995 username "user@example.com" password "xxxxxx" ssl mda "/var/www/html/requesttracker/bin/rt-mailgate --queue YLN --action correspond --url https://subdomain.example.com " nokeep
Nothing. The fetchmail.log file remains empty.
So then I tried this and restarted fetchmail:
set daemon 60
set invisible
set postmaster administrator
set syslog
poll pop.gmail.com protocol pop3 port 995 username "user@example.com" password "xxxxxx" ssl mda "/var/www/html/requesttracker/bin/rt-mailgate --queue YLN --action correspond --url https://subdomain.example.com " nokeep
Again nothing. There are sendmail entries in the maillog file from my testing but they're from hours ago.
I figured out to run sudo env LC_ALL=C fetchmail -vvv --nodetach --nosyslog -f /etc/fetchmailrc
to see what's happening when it connects with Google. As it turns out, I didn't have one of those special passwords that Google needs to generate for you. If you're in this boat, see https://security.google.com/settings/security/apppasswords .
Chanel
(109 rep)
Oct 25, 2022, 04:10 PM
• Last activity: Oct 25, 2022, 09:43 PM
1
votes
1
answers
3071
views
fetchmail: fetch sent mail to sent folder, or fetch to a target folder
How can I configure fetchmail to fetch a folder to a specific target folder? Or at least not fetch to inbox? If it would fetch from sent to sent (or any folder to the same folder name) I'd be happy with it. Fetching sent and putting them in my inbox and marking them as "new mail" would be crazy, now...
How can I configure fetchmail to fetch a folder to a specific target folder? Or at least not fetch to inbox? If it would fetch from sent to sent (or any folder to the same folder name) I'd be happy with it.
Fetching sent and putting them in my inbox and marking them as "new mail" would be crazy, now wouldn't it?
The Quantum Physicist
(973 rep)
May 31, 2015, 10:46 AM
• Last activity: Sep 5, 2022, 04:17 PM
5
votes
2
answers
3445
views
Download big imap directory to maildir
I search a solution to download (for archiving) a large mail directory via imap from a mail-server and stores all mails in a local maildir. I need a robust solution, which repeatedly tries if time-outs occur. So far I have tried using regular mail clients for this. Apparently the server restricts do...
I search a solution to download (for archiving) a large mail directory via imap from a mail-server and stores all mails in a local maildir. I need a robust solution, which repeatedly tries if time-outs occur. So far I have tried using regular mail clients for this. Apparently the server restricts downloads in a way which confuses the clients I have tried so far in that they eventually give up and even loose mails. I am thinking of a tool like fetchmail, but the howtos I have seen are either a bit long or don't fit exactly my needs, such as http://llg.cubic.org/docs/imapbackup.html which describes download to mbox files. It remains unclear to me whether the maildir format is supported.
highsciguy
(2614 rep)
Feb 27, 2015, 11:39 AM
• Last activity: Jun 13, 2022, 01:40 AM
1
votes
2
answers
255
views
procmail returning with exit code 0 even if it can't read its config file: How to prevent?
I am dealing with `procmail` the first time, so I apologize if the following question is stupid. Before I put `procmail` in production, I am doing a few basic tests. One of them yielded a totally unexpected result which makes it nearly worthless in my scenario: When `procmail` cannot read its config...
I am dealing with
procmail
the first time, so I apologize if the following question is stupid. Before I put procmail
in production, I am doing a few basic tests. One of them yielded a totally unexpected result which makes it nearly worthless in my scenario:
When procmail
cannot read its configuration file, it nevertheless sets its exit code to 0
(true) when it finishes. This is catastrophic, because in my scenario, I am using procmail
as an MDA which is executed from within fetchmail
. If procmail
can't read its configuration file, it can't process (deliver) messages as needed, but sets exit code 0
when it finishes; fetchmail
interprets this as successful delivery and deletes the respective messages upstream. In summary, this leads to those messages being lost.
The permissions in this scenario are quite complex (fetchmail
+ procmail
+ cyrdeliver
over lmtp
, fetchmail
running under its own user account, procmail
being suid
and setgid
, and so on), so it could very well happen that somebody makes a mistake with the permissions when something needs to be changed. Due to the problem described above, such mistakes likely lead to loss of messages.
Therefore, I'd like to know how to make procmail
to exit with failure (exit code other than 0
) if it can't read its configuration file.
To give an idea what this is about, please consider the following terminal session (irrelevant lines removed). Please note that the ownership / permissions in the config directory are wrong by intention, because this is my test case.
root@morn /etc/fetchmail # whoami
root
root@morn /etc/fetchmail # dir
total 52K
drwx------ 2 fetchmail root 4.0K 2022-01-23 10:09 .
drwxr-xr-x 123 root root 12K 2022-01-22 17:17 ..
-rw------- 1 fetchmail root 2.4K 2022-01-23 10:09 fetchmailrc
-rw------- 1 root mail 282 2022-01-23 02:49 procmailrc
-rw-r--r-- 1 root root 110 2022-01-23 00:36 testmessage
root@morn /etc/fetchmail # dir which procmail
-rwsr-sr-x 1 root mail 92K 2017-11-16 23:42 /usr/bin/procmail
root@morn /etc/fetchmail # cat /etc/systemd/system/pp-fetchmail.service
User=fetchmail
Group=mail
ExecStart=/usr/bin/fetchmail -f /etc/fetchmail/fetchmailrc --pidfile /run/fetchmail/fetchmail.pid --syslog
root@morn /etc/fetchmail # cat fetchmailrc
poll
pop3.example.com
proto pop3
bad-header accept
user "user1@example.com"
ssl
pass "supersecret"
is "user1" here
no rewrite
mda "/usr/bin/procmail TARGET=user1 /etc/fetchmail/procmailrc"
root@morn /etc/fetchmail # cat testmessage
From: nobody@nowhere.com
To: somebody@somewhere.com
Subject: Test message
This is a test message.
root@morn /etc/fetchmail # sudo -u fetchmail -g mail /usr/bin/procmail /etc/fetchmail/procmailrc < testmessage && echo "procmail exited 0"
procmail: Couldn't read "/etc/fetchmail/procmailrc"
procmail exited 0
Of course, the last two lines are the problem. Does anybody know how to circumvent it? Of course, fixing the permissions would make it work correctly, but that is what I'm explicitly not asking for. I'd like to have a solution which is more robust in case of mistakes (mine or others').
Binarus
(3891 rep)
Jan 23, 2022, 10:11 AM
• Last activity: Jan 24, 2022, 07:18 AM
3
votes
2
answers
3064
views
Make fetchmail leave mail on server for a specified period of time?
I know that fetchmail can be configured to leave mail on the server (usually done with the `keep uidl` keyword combination), but is there a way to configure it to leave mail on the server *for a specified minimum period of time* and delete them thereafter? For example, suppose I want messages to rem...
I know that fetchmail can be configured to leave mail on the server (usually done with the
keep uidl
keyword combination), but is there a way to configure it to leave mail on the server *for a specified minimum period of time* and delete them thereafter?
For example, suppose I want messages to remain on the server for 48 hours after they have been downloaded, and then be deleted on the next fetchmail invocation against that server.
I am mostly interested in solutions that work with POP3.
user
(29991 rep)
Sep 26, 2012, 09:57 AM
• Last activity: Dec 28, 2021, 10:07 AM
0
votes
1
answers
145
views
Installing fetchmail - Not found in current repositories
**Background** This is probably very basic for someone, but I can not figure this out for the life of me. I wish to simply install fetchmail onto my raspberry pi. Using the command `sudo apt-get install fetchmail` results in the following: [![enter image description here][1]][1] **What I have tried*...
**Background**
This is probably very basic for someone, but I can not figure this out for the life of me. I wish to simply install fetchmail onto my raspberry pi. Using the command
**What I have tried**
I have tried
sudo apt-get install fetchmail
results in the following:

sudo apt-get update
which goes through the process of updating, then follow with the install command for fetchmail shown above, but the same result. Per fetchmail's own page it states that the sources are also available at two repositories: https://gitlab.com/fetchmail/fetchmail and https://sourceforge.net/p/fetchmail/git/
I am not very experienced at adding repositories as my attempts have failed. I did take a look at /etc/apt/sources.list
and tried to mimic the one found in here but it just results in errors for me.
I know this is probably very basic for most, but I really can't figure this out so much appreaciated!
Eric F
(111 rep)
Nov 7, 2021, 01:17 AM
• Last activity: Nov 9, 2021, 02:32 PM
0
votes
0
answers
549
views
Mail Retrieve Software for Microsoft 365
As Microsoft 365 is moving to Oauth2, and Fetchmail didn't release a stable version supporting it (only an Alpha on the version 7, but not solid), my organization is looking for a IMAP mail retrieve service like Fetchmail to: Save on the disk mail data like: header body attachments This service/daem...
As Microsoft 365 is moving to Oauth2, and Fetchmail didn't release a stable version supporting it (only an Alpha on the version 7, but not solid), my organization is looking for a IMAP mail retrieve service like Fetchmail to:
Save on the disk mail data like:
header
body
attachments
This service/daemon should run on a linux server.
I'm trying to figure out if it's possible to use Getmail, I can't find a configuration for Microsoft 365, only for Gmail.
** UPDATE **
I've found an application called Mutt, and I'm following this documentation:
mutt oauth2
But I get no authenticators available for now, I bet I'll miss something in the muttrc config, or in the Azure configurations.
My plans is to use this library, also:
mutt wizard
expecially for the isync integration. I don't have experience with MailDir, but probably when I have the backups into my disk it would be easier to get mail info + attachements.
Anyone that have experience with this?
** 2 UPDATE **
I opened an issue on Mutt Github. I can't find a way to save Outlook Mail locally.
Edoardo Zucchelli
(1 rep)
Apr 29, 2021, 08:42 AM
• Last activity: Apr 30, 2021, 09:59 AM
2
votes
1
answers
464
views
What is the meaning of %F, %T, and %s in fetchmail's mda option?
Browsing through web pages around the World Wide Web, I often come across `~/.fetchmailrc` examples such as: ``` poll mail.example.com port 993 proto imap user "max123" password "123456" mda "/usr/bin/procmail -f %F -d %T" ``` What do the `%F` and `%T` mean? Sometimes, I also see `%s`. Where can I f...
Browsing through web pages around the World Wide Web, I often come across
~/.fetchmailrc
examples such as:
poll mail.example.com
port 993
proto imap
user "max123" password "123456"
mda "/usr/bin/procmail -f %F -d %T"
What do the %F
and %T
mean? Sometimes, I also see %s
. Where can I find the documentation of all the available %
options? I have looked at the [fetchmail manual](https://www.fetchmail.info/fetchmail-man.html) , but it doesn't document this.
Flux
(3238 rep)
Mar 6, 2021, 02:13 AM
• Last activity: Mar 6, 2021, 08:49 AM
1
votes
1
answers
2510
views
O365 attempting to use fetchmail to poll emails to local postfix/dovecot mails server
We currently have an application that uses IMAP/POP3 to access mail in O365; however, Microsoft has determined that they will no longer be allowing basic authentication. By do this, the application does not have the inability to use modern auth to access the mail in O365. So I am forced to build a p...
We currently have an application that uses IMAP/POP3 to access mail in O365; however, Microsoft has determined that they will no longer be allowing basic authentication. By do this, the application does not have the inability to use modern auth to access the mail in O365. So I am forced to build a postfix/dovecot mail server, that I'd like to use fetchmail to pull the mail from O365 into the new mail server so the application can access the mail. So my question, does fetchmail have this ability to use modern auth to poll the mail in O365 using IMAP/POP3, and if not, can anyone guide me to one that can?
Thanks
**Update**
When running fetchmail the follwoing error I get,
fetchmail: IMAP A0002 LOGIN "tst@domain.com" *
fetchmail: IMAP A0003 LOGOUT
fetchmail: IMAP< * BYE Closing connection
fetchmail: IMAP< A0003 OK LOGOUT completed
Checking davmail log I'm getting the following,though not sure why I'm running into this issue.
2020-10-21 13:37:50,916 DEBUG [ImapConnection-42868] davmail - < LOGIN ********
2020-10-21 13:37:50,917 WARN [ImapConnection-42868] davmail.exchange.ExchangeSession - All network interfaces down or host unreachable !
2020-10-21 13:37:50,918 DEBUG [ImapConnection-42868] davmail.exchange.ExchangeSession - java.lang.ClassNotFoundException: davmail.exchange.auth.O365InteractiveAuthenticator
java.lang.ClassNotFoundException: davmail.exchange.auth.O365InteractiveAuthenticator
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:180)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:95)
at davmail.imap.ImapConnection.run(ImapConnection.java:113)
2020-10-21 13:37:50,920 INFO [ImapConnection-42868] davmail.connection - FAILED - 0:0:0:0:0:0:0:1:42868 tst@domain.com
helpo11
(21 rep)
Oct 20, 2020, 04:00 PM
• Last activity: Oct 21, 2020, 05:48 PM
2
votes
1
answers
1054
views
Fetchmail fails to deliver mail locally due to enforced STARTTLS
I have setup a local mail server using `postfix` and `dovecot`. I now want `fetchmail` to get my mails from another server and deliver them locally. I am getting errors, however, since `fetchmail` does not use `STARTTLS` when connecting via `SMTP` to the local `postfix`: reading message 852 of 853 (...
I have setup a local mail server using
postfix
and dovecot
. I now want fetchmail
to get my mails from another server and deliver them locally. I am getting errors, however, since fetchmail
does not use STARTTLS
when connecting via SMTP
to the local postfix
:
reading message 852 of 853 (18519 octets) (log message incomplete)
SMTP> MAIL FROM: SIZE=18519
SMTP RSET
According to this previous question this is because fetchmail
does not support STARTTLS
when talking to an SMTP
server and states that it
> is normally not a problem, as it usually delivers emails locally.
I therefore conclude that my configuration is flawed in some way. I want connections to postfix
to be secure when a MUA delivers mail but obviously I cannot enforce it if I want to use fetchmail
. Is it the way to go to relax the security constraints in postfix's master.cf
for SMTP
and only enforce STARTTLS
for SUBMISSION
?
sigy
(123 rep)
Mar 28, 2017, 08:46 PM
• Last activity: Jul 10, 2020, 07:06 PM
16
votes
2
answers
11691
views
How to sync a local email storage to IMAP (mutt-friendly)?
## Summary **My problem**: I want to read email offline with my choice of client (`mutt`), but I want actions like moving emails, etc. to be kept in two-way snc with an imap server. **My question**: Is there a straightforward way to do this while still using standard tools like `fetchmail`, `procmai...
## Summary
**My problem**: I want to read email offline with my choice of client (
mutt
), but I want actions like moving emails, etc. to be kept in two-way snc with an imap server.
**My question**: Is there a straightforward way to do this while still using standard tools like fetchmail
, procmail
, etc.?
## Details
I have a gmail account. For various reasons - some institutional - I need to be able to read this mail from a mail client; I want my 'inbox' to be clean, much like I would keep it with a traditional local mail setup, and for anything I 'archive' to be searchable. If I move an email to a folder in the web client, I'd like my local inbox to take this into account.
When possible, I want to be able to read this mail from mutt
. Previously I used mutt's native imap functionality, but mutt has to make a connection to the server each time you run it; the connection often drops while I'm reading mail and mutt is open in the background; it only keeps a cache of message headers, and loading new messages requires a round-trip to the server; if I send a message, I have to wait for it to be acknowledged over STMP before I can look at any other messages.
Is there some way around this? I don't consider fat clients like Thunderbird to be a solution: I require terminal access, I like to be able to grep my mail, I make good use of procmail's filtering capabilities, and I prefer decoupled systems.
As mentioned above, fetchmail
, procmail
and sendmail
get me *almost* there - but not quite to being able to keep my activity in sync between clients.
Am I missing something? I've looked at the FreeBSD handbook's section on email and a bunch of blog posts but nothing seems to bring it all together in this way.
By the way, I run Arch Linux and Debian.
Cera
(534 rep)
Apr 14, 2013, 05:43 AM
• Last activity: Jul 6, 2020, 01:16 AM
0
votes
2
answers
1065
views
How do I setup email on FreeBSD?
I am new to handling things in a low level fashion and I am horrified at the lack of documentation for newbies who have had zero experience setting up MTAs, MDAs, etc. I simply need to connect to my Gmail account using SMTP and IMAP to send and receive email. I tried reading about sendmail, fetchmai...
I am new to handling things in a low level fashion and I am horrified at the lack of documentation for newbies who have had zero experience setting up MTAs, MDAs, etc. I simply need to connect to my Gmail account using SMTP and IMAP to send and receive email. I tried reading about sendmail, fetchmail, etc, but I still on level zero of setting up a usable system. How do I achieve this? I don't want my to setup GUI based applications like Thunderbird.
Vishal Subramanyam
(101 rep)
May 15, 2020, 12:26 AM
• Last activity: May 15, 2020, 11:18 AM
6
votes
1
answers
2439
views
What replaces /etc/services in openSUSE, and how
I am running openSUSE Linux, the Tumbleweed version. I discovered that it does not use an /etc/services file, though I do not know what is replacing it, or how it is done, and I do not have much success searching the web. Actually, what happened to me is that my mail system stopped working correctly...
I am running openSUSE Linux, the Tumbleweed version. I discovered that it does
not use an /etc/services file, though I do not know what is replacing it, or
how it is done, and I do not have much success searching the web.
Actually, what happened to me is that my mail system stopped working correctly
after a major system update, both in-mail and out-mail. After much testing and
debugging with a more expert user (of other Linux distros), we
discovered that the /etc/services file was missing.
Thinking it had been accidentally destroyed, we created a small one to provide
at least for the ports used for email. And it did solve my mail problems.
To do things cleanly, I asked another openSUSE Tumbleweed user for his copy of
the file as provided in the distribution. But he did not find it in his own
system, which has no mail problem. So, it is not necessary.
Apparently, I had solved my problem by accident.
Could someone at least confirm that /etc/services is no longer normally used
in this openSUSE Linux. But I would like an explanation of how things are now
done, and if possible of why my problem was solved by adding /etc/services,
and whether I could solve it without /etc/services.
(reported to the best of my understanding and memory of events)
babou
(878 rep)
Feb 20, 2020, 12:17 AM
• Last activity: Mar 6, 2020, 05:55 PM
4
votes
5
answers
3332
views
Why can't I echo the password to fetchmail?
I'm trying to configure a fetchmail. Before I deal with the syntax of fetchmailrc ( I discovered that the level of bugginess of a problem is synergistic with the number of different aspects of the problem that I do not understand, so one new thing at a time ), I decided to pass all the options via c...
I'm trying to configure a fetchmail. Before I deal with the syntax of fetchmailrc ( I discovered that the level of bugginess of a problem is synergistic with the number of different aspects of the problem that I do not understand, so one new thing at a time ), I decided to pass all the options via commandline.
I got tired of entering the password for each test so I wanted to pass it in the script. I couldn't find something like --pass as a commandline option for fetchmail so I thought maybe echo the password to fetchmail ala:
echo "dohadeer"| fetchmail --all -p pop3 -k pop.gmail.com --ssl -d0 --user FakeName@gmail.com
I dismissed it and googled "fetchmail password commandline" and got several hits which claimed the above technique worked! But when I tried it I get the error:
fetchmail: can't find a password for FakeName@gmail.com@pop.gmail.com.
I can figure out workarounds for the original problem, but I can't figure out why this approach doesn't work. Obviously there is something I don't understand about Linux and want to figure out.
HandyGandy
(2239 rep)
Nov 11, 2011, 07:02 AM
• Last activity: Nov 16, 2019, 02:26 AM
2
votes
1
answers
3447
views
Forward/Redirect email fetched via fetchmail to gmail
I am on a mac using terminal. I am trying to redirect email from a work email to gmail (the work email only allows IMAP and gmail can only fetch from POP - hence the workaround). I have successfully configured fetchmail to fetch the mail from the work email. I would now like to REDIRECT it to gmail,...
I am on a mac using terminal. I am trying to redirect email from a work email to gmail (the work email only allows IMAP and gmail can only fetch from POP - hence the workaround).
I have successfully configured fetchmail to fetch the mail from the work email.
I would now like to REDIRECT it to gmail, such that when it arrives it appears to arrive from (and I can reply to) the *original* sender.
I have tried both procmail and ssmtp with following configurations. For BOTH, the email does arrive in my gmail inbox however it appears to come from ME myusername@gmail.com rather than the original sender.
Any suggestions? I am *very* new at this. Welcome suggestions using procmail or ssmtp (or if it will work anything else!)
**procmail set up**
.fetchmailrc file:
set no bouncemail
poll outlook.office365.com with protocol imap
port 993
auth password
user user@domain.com password password
ssl
sslfingerprint ""
sslcertpath /Users/myuser/.certs
keep
no rewrite
mda "/usr/local/bin/procmail -f %F -d %T";
.procmailrc file
VERBOSE=yes
:0
! myusername@gmail.com
(with sendmail configured to send from my gmail, as per my answer here: https://unix.stackexchange.com/questions/369842/using-procmail-to-forward-to-gmail/369854#369854)
**ssmtp set up**
/opt/local/etc/ssmtp/ssmtp.conf file
root=FIXME@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=localhost
UseTLS=Yes
UseSTARTTLS=Yes
AuthUser=FIXME@gmail.com
AuthPass=Hunter2
FromLineOverride=yes
(have also tried without root line, and with rewriteDomain=gmail.com)
.fetchmailrc file, same as above except mda line is now:
mda "/opt/local/sbin/ssmtp FIXME@gmail.com"
Amanda
(33 rep)
Jun 9, 2017, 03:41 PM
• Last activity: Oct 4, 2019, 08:02 PM
Showing page 1 of 20 total questions