LukeSmithxyz / mutt-wizard

A system for automatically configuring mutt and isync with a simple interface and safe passwords
GNU General Public License v3.0
2.39k stars 382 forks source link

mailsync not downloading mail via cron #973

Closed Quadrant6630 closed 5 months ago

Quadrant6630 commented 9 months ago

When mailsync runs via cron, new mail is never downloaded. I can confirm that it is running as I altered the command in crontab generated by the wizard to write to a log. Every minute (as I have it configured), I get the line 'No new mail for email.' in the log. If I run mailsync directly on the command line or use the 'o' command in neomutt, new messages are downloaded successfully.

Because I thought this might be the problem, I removed the passphrase from my gpg key, but the problem persists. I'm on a Mac with Sonoma 14.1.2. "cron" has been granted full disk access.

Any thoughts? Thanks.

Quadrant6630 commented 8 months ago

Still not sure what the issue was, but I solved it by just bypassing the mailsync file and using mbsync directly. The following crontab config is working for me.

❯ crontab -l
* * * * * /opt/homebrew/bin/mbsync -a
* * * * * /opt/homebrew/bin/notmuch new
LeoAdL commented 7 months ago

The solution is to add homebrew to the PATH of crontab by writing to the top of crontab -e:

PATH=/usr/local/bin:/opt/homebrew/bin/
Quadrant6630 commented 7 months ago

Like this?

❯ crontab -l
PATH=/usr/local/bin:/opt/homebrew/bin/
* * * * * /usr/local/bin/mailsync

This is still not working for me. Perhaps I am misunderstanding?

LeoAdL commented 7 months ago

My output is:

❯ crontab -l

PATH=/usr/local/bin:/usr/bin:/bin:/opt/homebrew/bin/

* * * * * /usr/local/bin/mailsync

Maybe some scripts needed are in usr/bin or bin/ ?

Quadrant6630 commented 7 months ago

This is working now. Thanks so much!

chasylexus commented 6 months ago

I've had the same problem and tried to fix that with adding 'PATH' line to cron -e. But it doesn't work for me. I've seen messages from cron and see that:

gpg: public key decryption failed: No such file or directory
gpg: decryption failed: No such file or directory
Skipping account <mail address>-remote, PassCmd exited with status 2
No new mail for <mail address>.

Any ideas how to fix that?

upd: that helped: https://dev.to/zemse/setup-gpg-on-macos-2iib

tjex commented 5 months ago

@Quadrant6630

This is working now. Thanks so much!

pls close the issue if so :)