Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sent mail does not get stored in Maildir/.Sent folder #622

Open
M-Stenzel opened this issue Nov 26, 2024 · 12 comments
Open

Sent mail does not get stored in Maildir/.Sent folder #622

M-Stenzel opened this issue Nov 26, 2024 · 12 comments

Comments

@M-Stenzel
Copy link

Hi team,
thank you for this nice software.
I run the latest version of sup & ruby 3.1 on Linux.

This is in my config.yaml

:sent_source: maildir:/home/m.xx/Maildir

All my sent mails are in the directory /home/m.xx/Maildir/.Sent/cur when I use other mail clients

But sup does not keep a copy of the sent mail in this directory.

Please note that sup and the Maildir (home) folder are on the same server, no need to fetch or deliver mail.

Any ideas?

Martin.

@danc86
Copy link
Contributor

danc86 commented Nov 26, 2024

/home/m.xx/Maildir and /home/m.xx/Maildir/.Sent are distinct maildirs. You will probably find that sup has been saving your sent mails under /home/m.xx/Maildir/new/.

I think you wanted to use this instead:

:sent_source: maildir:///home/m.xx/Maildir/.Sent

@M-Stenzel
Copy link
Author

No, it does not change things, the mail is not copied to the sent mail folder.
Any way to debug this???

Martin.

@danc86
Copy link
Contributor

danc86 commented Nov 26, 2024

Does it save the sent mails anywhere?

To debug further, you can run sup with SUP_LOG_LEVEL=debug set in the environment. After sending a mail, you can view the log by pressing ; and choosing the system log buffer. You should see messages like this relating to the sent message being saved:

[2024-11-27 08:37:15 +1100] store the sent message (locking sent source..)
[2024-11-27 08:37:15 +1100] trying to acquire poll lock for: maildir:///home/dan/.maildir/.Sent...
[2024-11-27 08:37:15 +1100] lock acquired for: maildir:///home/dan/.maildir/.Sent
[2024-11-27 08:37:15 +1100] polling maildir /home/dan/.maildir/.Sent/cur
[2024-11-27 08:37:15 +1100] polling maildir /home/dan/.maildir/.Sent/new
[2024-11-27 08:37:15 +1100] benchmark maildir_read_index:   0.000715   0.000145   0.000860 (  0.000852)
[2024-11-27 08:37:15 +1100] benchmark maildir_read_dir:   0.001224   0.000000   0.001224 (  0.001243)
[2024-11-27 08:37:15 +1100] 119 in index, 120 in filesystem
[2024-11-27 08:37:15 +1100] 1 added, 0 deleted, 0 updated
[2024-11-27 08:37:15 +1100] read 'before-add-message' from /home/dan/.sup/hooks/before-add-message.rb
[2024-11-27 08:37:15 +1100] syncing back maildir message new/1732657035.425011816323.honeycomb:2,S with flags [:sent]
[2024-11-27 08:37:15 +1100] lock released for: maildir:///home/dan/.maildir/.Sent

@M-Stenzel
Copy link
Author

Well, this is what I get...

[2024-11-26 23:49:47 +0200] trying to acquire poll lock for: maildir:/home/m.stenzel/Maildir...
[2024-11-26 23:49:47 +0200] lock acquired for: maildir:/home/m.stenzel/Maildir
[2024-11-26 23:49:47 +0200] polling maildir /home/m.stenzel/Maildir/cur
[2024-11-26 23:49:47 +0200] benchmark maildir_read_index: 0.019536 0.000001 0.019537 ( 0.019538)
[2024-11-26 23:49:47 +0200] benchmark maildir_read_dir: 0.022502 0.007707 0.030209 ( 0.030218)
[2024-11-26 23:49:47 +0200] 13644 in index, 13645 in filesystem
[2024-11-26 23:49:47 +0200] polling maildir /home/m.stenzel/Maildir/new
[2024-11-26 23:49:47 +0200] benchmark maildir_read_index: 0.000032 0.000000 0.000032 ( 0.000031)
[2024-11-26 23:49:47 +0200] benchmark maildir_read_dir: 0.000020 0.000000 0.000020 ( 0.000020)
[2024-11-26 23:49:47 +0200] 0 in index, 0 in filesystem
[2024-11-26 23:49:47 +0200] 2 added, 1 deleted, 0 updated
[2024-11-26 23:49:47 +0200] read 'mime-decode' from /home/m.stenzel/.sup/hooks/mime-decode.rb
[2024-11-26 23:49:47 +0200] lock released for: maildir:/home/m.stenzel/Maildir
[2024-11-26 23:49:47 +0200] trying to acquire poll lock for: sup://drafts...
[2024-11-26 23:49:47 +0200] lock acquired for: sup://drafts
[2024-11-26 23:49:47 +0200] lock released for: sup://drafts
[2024-11-26 23:49:47 +0200] trying to acquire poll lock for: sup://sent...
[2024-11-26 23:49:47 +0200] lock acquired for: sup://sent
[2024-11-26 23:49:47 +0200] benchmark mbox_read_index: 0.000062 0.000008 0.000070 ( 0.000067)
[2024-11-26 23:49:47 +0200] lock released for: sup://sent
[2024-11-26 23:49:50 +0200] store the sent message (locking sent source..)
[2024-11-26 23:49:58 +0200] colormap: for color system_buf_color_highlight, using id 10 -> 7, 6
[2024-11-26 23:49:59 +0200] trying to acquire poll lock for: sup://sent...

so not the same...

@M-Stenzel
Copy link
Author

Could it be that this entry in the config.yaml file is faulty?

:sendmail: "/usr/sbin/sendmail -oem -ti"

Martin.

@M-Stenzel
Copy link
Author

No, checked this, too.
Could it be that config.yaml in ~/.sup/ does not get read?

This is my ~/.sup/config.yaml (redacted some information)

---
:accounts:
  :default:
    :name: Myname
    :email: m.stenzel@myemail
    :alternates: []
    :sendmail: "msmtp -t --read-envelope-from"
    :signature: "/home/myhome/.signature"
    :gpgkey: ''
:editor: vi
:thread_by_subject: false
:edit_signature: false
:ask_for_from: false
:ask_for_to: true
:ask_for_cc: true
:ask_for_bcc: true
:ask_for_subject: true
:account_selector: true
:confirm_no_attachments: true
:confirm_top_posting: true
:jump_to_open_message: true
:discard_snippets_from_encrypted_messages: false
:load_more_threads_when_scrolling: true
:default_attachment_save_dir: ''
:sent_source: maildir:///home/myhome/Maildir/.Sent/
:archive_sent: true
:poll_interval: 300
:wrap_width: 0
:slip_rows: 0
:indent_spaces: 2
:col_jump: 2
:stem_language: english
:sync_back_to_maildir: false
:continuous_scroll: false
:always_edit_async: false
:time_mode: 24h

What piece is missing?

Martin.

@M-Stenzel
Copy link
Author

My log file contains:

benchmark mbox_read_index

I never defined the use of "mbox"

@M-Stenzel
Copy link
Author

No, checked this, too. Could it be that config.yaml in ~/.sup/ does not get read?

This is my ~/.sup/config.yaml (redacted some information)

---
:accounts:
  :default:
    :name: Myname
    :email: m.stenzel@myemail
    :alternates: []
    :sendmail: "msmtp -t --read-envelope-from"
    :signature: "/home/myhome/.signature"
    :gpgkey: ''
:editor: vi
:thread_by_subject: false
:edit_signature: false
:ask_for_from: false
:ask_for_to: true
:ask_for_cc: true
:ask_for_bcc: true
:ask_for_subject: true
:account_selector: true
:confirm_no_attachments: true
:confirm_top_posting: true
:jump_to_open_message: true
:discard_snippets_from_encrypted_messages: false
:load_more_threads_when_scrolling: true
:default_attachment_save_dir: ''
:sent_source: maildir:///home/myhome/Maildir/.Sent/
:archive_sent: true
:poll_interval: 300
:wrap_width: 0
:slip_rows: 0
:indent_spaces: 2
:col_jump: 2
:stem_language: english
:sync_back_to_maildir: false
:continuous_scroll: false
:always_edit_async: false
:time_mode: 24h

What piece is missing?

Martin.

P. S. This is my sources.yaml

---
- !<tag:supmua.org,2006-10-01/Redwood/Maildir>
  uri: maildir:/home/myhome/Maildir
  usual: true
  archived: false
  sync_back: false
  id: 1
  labels: []

@M-Stenzel
Copy link
Author

Gee,

by accident I found a "sent.mbox" file in my .sup directory. I found a copy of my sent mails in there.

This means that sup seems to insist, that it should use mbox instead of Maildir for storing the mails...

@M-Stenzel
Copy link
Author

Ready to pull my hairs out...

Even tried this ancient info

#255

by defining the ".Sent" directory as second "source"

Did not help...

@M-Stenzel
Copy link
Author

M-Stenzel commented Nov 29, 2024

O. K... one more - probably final - posting....

I can't convince sup to store in the Maildir folder... ready to accept that.

This is a - non dirty - hack to get things going,

I wrote the following tiny script that will put the mails into Maildir
N. B. You need to create the ".maildir" directory first!

#!/bin/sh

if [ -s ~/.sup/sent.mbox ]; then
  /usr/bin/mb2md -s ~/.sup/sent.mbox -d ~/.maildir
  truncate -s 0 ~/.sup/sent.mbox
  cp -a ~/.maildir/cur/*  ~/Maildir/.Sent/cur
  rm -f ~/.maildir/cur/*
fi

exit 0

If you use it with https://mmonit.com/monit/ (I use it for other things, as well, rather handy...) there will be an instant execution of the script. And you can do without the "if" statement.

Maybe of help...

@danc86
Copy link
Contributor

danc86 commented Nov 30, 2024

The sup://sent source you saw in the log is sup's default fallback place to save sent mails, which is indeed an mbox at ~/.sup/sent.mbox as you discovered. It seems that sup is not obeying the :sent_source: in your ~/.sup/config.yaml for some reason. Specifically, it must be nil: https://github.com/sup-heliotrope/sup/blob/develop/lib/sup.rb#L174

What you pasted looks almost identical to my config.yaml which works fine. Does sup obey any of the settings in your config.yaml? I feel like there is some typo or subtle bug happening here.

As you saw in #255, you need to configure your sent mbox or maildir as a source if you want sup to index and display sent mails after you have sent them. But it's not related to where sup will save the sent mails to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants