Re: Scheduling mails

2024-04-03 Thread João Pedro
Em quarta, 03/04/2024 às 07:06 (-03), David Bremner  
escreveu:

> Message properties might work a bit better than tags

Ah, indeed message properties seem to be more appropriate. Are they
persisted, or are they tied to an Emacs session? Because I would like to
have it so that even if I kill my Emacs session and open a new one, if
the message has the `:scheduled' property with the right time, it should
be sent. There's also concerns on what to do when Emacs was not up when
the scheduled time arrived. Do we 1. send it immediately? or 2. inform
the user it was not able to deliver the message? Going with the latter
has the caveat that it might be missed by the user, and one would be
clueless to the fact that their message hadn't arrived.

> but your periodic search would still have to search for all of the
> scheduled=time properties (wildcard search is currently only supported
> using s-exp queries).

How about having a list of '(MESSAGE-ID . SCHEDULED-TIME), with the
periodic check looking in that list for the scheduled times? It would
have the issue of it not being persistent between Emacs sessions, but I
think that could be addressed by letting the users know this lack of
persistance, and documenting how you could achieve it with
`savehist-additional-variables'.

> I would suggest having a look at the existing draft handling, as what
> you describe sounds like it is related.

Taking a quick glance at it, it seems like we could have a similar
thing, where scheduled messages are saved to the database somewhere,
with either the tag, as it is with drafts, or just the message property
as you suggested.

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Scheduling mails

2024-04-01 Thread João Pedro
Em terça, 02/04/2024 às 02:05 (+01), Jose A Ortega Ruiz  escreveu:

> I might be wrong, but I don't think the Gnus agent can be easily reused
> from notmuch. We could perhaps save the message as a draft upon C-c C-j,
> and then have a periodic timer that checks if any of the drafts has
> expired (maybe using a special, additional tag for the search) and send
> it?

I think we should be able to use a similar logic to
`gnus-delay-article': it adds an X-Gnus-Delayed header with a timestamp
and seems to, as you proposed, periodically check for scheduled
messages. The header holds a timestamp for the prompted scheduled time
(which can be given in as an absolute date, or relative to the current
time) and we could add to that a `scheduled' tag or something along
those lines.

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Scheduling mails

2024-04-01 Thread João Pedro
Hi there,

This might not be the best mailing list to ask this, but I figured I
could at least be given some directions.

I am using notmuch in Emacs, with mbsync and msmtp (I actually use
smtpmail.el in Emacs, but it uses the `sendmail' command, which is
symlinked to msmtp) and the only thing I miss from other mail clients is
the ability to schedule a mail to be sent on a certain time. I do also
use `message-mode' to compose my emails, and it has `gnus-delay-article'
bound to C-c C-j, which at first sight seems to be exactly what I
need. The problem is, when calling it from =notmuch-message-mode= I get
a `wrong-type-argument' from the first line of `gnus-agent-queue-setup',
which tries to get a value from a hash table stored in a variable that
is initialized with nil. Gnus must initialize this variable with some
sort of hash table, but I could not emulate this behaviour to make this
scheduling work. Is it possible to use `message-mode''s scheduling
facility with notmuch?

Cheers,

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: moving mail to another maildir based on tags and renaming files

2022-05-23 Thread João Pedro
amp;& mv -v "$f" "$new"
done
done
}

case $1 in
out) move_out ;;
in) move_in ;;
*) move_out
   move_in
   ;;
esac

And this is my =pre-new= hook:

#!/bin/sh
#
# commands/hooks to run before `notmuch new`
#
alias nmsearch="$(command -v notmuch) search --exclude=false --output=files -- 
not folder:queued and"

# do the moving things
~/.config/notmuch/hooks/move-mail

# remove files tagged with 'rm', a tag i use to actually delete emails
for f in $(nmsearch --output=files -- tag:rm); do [ -f "$f" ] && echo rm -i 
"$f"; done

mbsync -c "${XDG_CONFIG_HOME:-${HOME}/.config}/isync/mbsyncrc" -a

The relevant part of my Emacs configuration for notmuch is the
following:

#+begin_src emacs-lisp
(defconst notmuch-mark-deleted-tags '("+trash" "-inbox" "-archived" "-sent" 
"-spam")
  "List of tags to mark for deletion.")

(defconst notmuch-mark-removed-tags (cons "+rm" notmuch-mark-deleted-tags)
  "List of tags to mark for removal.")

(defconst notmuch-mark-spam-tags '("+spam" "-inbox" "-trash" "-sent" 
"-archived")
  "List of tags to mark as spam.")

(defconst notmuch-mark-flagged-tags '("+flagged")
  "List of tags to mark as important (flagged).")

(defconst notmuch-mark-shopping-tags '("-inbox" "+shopping")
  "List of tags to mark as shopping.
This is related to emails from stuff I buy online.")

(defconst notmuch-mark-financial-tags '("-inbox" "+finance")
  "List of tags to mark as financial.")

(defconst notmuch-mark-meeting-tags '("-inbox" "+meeting")
  "List of tags to mark as meeting.")

(defconst notmuch-mark-account-tags '("-inbox" "+account")
  "List of tags to mark an e-mail as accounts related.
That is, this e-mail in particular is something link a
confirmation of registering or something similar.")

(setq notmuch-archive-tags '("-inbox" "+archived")
  notmuch-message-replied-tags '("+replied")
  notmuch-message-forwarded-tags '("+forwarded" "+sent" "-inbox" "-trash" 
"-spam")
  notmuch-show-mark-read-tags '("-unread")
  notmuch-draft-tags '("+draft" "-inbox" "-sent" "-trash" "-spam")
  notmuch-tagging-keys
  `((,(kbd "r") notmuch-show-mark-read-tags "Mark as read")
(,(kbd "u") ("+unread") "Mark as unread")
;; (,(kbd "c") notmuch-mark-complete-tags "Complete and archive")
(,(kbd "d") notmuch-mark-deleted-tags "Mark for deletion")
(,(kbd "R") notmuch-mark-removed-tags "Mark for removal")
(,(kbd "f") notmuch-mark-flagged-tags "Flag as important")
(,(kbd "s") notmuch-mark-spam-tags "Mark as spam")
(,(kbd "S") notmuch-mark-shopping-tags "Mark as shopping")
(,(kbd "F") notmuch-mark-financial-tags "Mark as financial")
(,(kbd "M") notmuch-mark-meeting-tags "Mark as meeting")
(,(kbd "A") notmuch-mark-account-tags "Mark as account")))
#+end_src

Best regards (and sorry for the long mail),

-- 
João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: changing smtp server and signature depending on from address

2022-04-25 Thread João Pedro
On 20 April 2022 11:35, alan.schm...@polytechnique.org wrote:

> Hello,

Hi Alan!

> I use several email addresses, and I would like to customize the smtp
> server and the signature I use for each of them. Is there a notmuch way
> of doing this?

I don't think notmuch has a built-in/default way of doing it, but
notmuch itself recommends using gnus-alias [1], like others have
recommended.

I myself have come up with my own system, which gets the information for
the addresses from auth-source [2]. It basically consists on an alist
that assigns an "alias" for each address and holds its information as a
plist. So, assuming I have a personal and work accounts, the alist would
be something like

  ((personal
(:address . "jpedrodeamo...@gmail.com")
(:name . "João Pedro")
(:host . "smtp.gmail.com")
(:key . "p")
(:signature . "João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)"))
   (work
(:address . "jpedrodeamo...@work.com")
(:name . "João Pedro")
(:host . "smtp.gmail.com")
(:key . "w")
(:signature . "João Pedro de Amorim Paula
Clojure(Script) engineer at Flexiana")))

The :key is something I assign by hand to each of my mail addresses, and
which I use to quickly choose with a single character using read-answer
[3].

I also have a couple of helper functions to correctly infer the account
I am using, and the information that smtpmail [4] needs to send my
e-mails (they are also store in auth-source, no sensitive information is
stored in plain text).

If you're interested, I could follow up on this thread detailing a
little more of how I glue it all together (by "it" I mean notmuch and
Emacs built-in Message and mail libraries), with the functions I use and
all. It currently isn't available in a public repo because I still have
some sensitive information that I need to have cryptographed before
doing so.

[1] https://notmuchmail.org/emacstips/#index16h2

[2] https://www.gnu.org/software/emacs/manual/html_mono/auth.html

[3] 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Multiple-Queries.html

[4] https://www.gnu.org/software/emacs/manual/html_mono/smtpmail.html

-- 
João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: Configurable deleted tags in notmuch-emacs

2021-11-30 Thread João Pedro de Amorim Paula
On 29 November 2021 16:33, David Bremner  wrote:

> João Pedro  writes:
>
>> Hello everyone.
>>
>> I'd like to suggest that the list of tags to applied to deleted drafts,
>> in notmuch-emacs, is made user configurable. To be more precise, with
>> notmuch-emacs version 0.34.1, under line 105 we have
>>
>> (defun notmuch-draft--mark-deleted ()
>>   "Tag the last saved draft deleted.
>>
>> Used when a new version is saved, or the message is sent."
>>   (when notmuch-draft-id
>> (notmuch-tag notmuch-draft-id '("+deleted"
>>
>> where the +deleted tag is hard coded. I, and I suppose a lot of other
>> users, use different tags for deleted emails. Currently I just override
>> notmuch-draft--mark-deleted, but it seems like it would be just a matter
>> of adding a defcustom akin to notmuch-draft-tags, though I'm not sure if
>> notmuch-draft.el would be the most appropriate location, or if it could
>> be reused in other scenarios.
>
> Sounds plausible. "deleted" is also hardcoded in
> notmuch-tag.el. notmuch-lib.el might be a reasonable place for the
> defcustom. There is already a defcustom there for notmuch-archive-tags.

All right, I'll try to structure what I already have in my custom
configuration in the notmuch-{lib,draft}.el, with the appropriate
documentation and all, and submit a patch by the end of this week.

-- 
João Pedro de Amorim Paula
IT undergraduate at Universidade Federal do Rio Grande do Norte (UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Configurable deleted tags in notmuch-emacs

2021-11-27 Thread João Pedro
Hello everyone.

I'd like to suggest that the list of tags to applied to deleted drafts,
in notmuch-emacs, is made user configurable. To be more precise, with
notmuch-emacs version 0.34.1, under line 105 we have

(defun notmuch-draft--mark-deleted ()
  "Tag the last saved draft deleted.

Used when a new version is saved, or the message is sent."
  (when notmuch-draft-id
(notmuch-tag notmuch-draft-id '("+deleted"

where the +deleted tag is hard coded. I, and I suppose a lot of other
users, use different tags for deleted emails. Currently I just override
notmuch-draft--mark-deleted, but it seems like it would be just a matter
of adding a defcustom akin to notmuch-draft-tags, though I'm not sure if
notmuch-draft.el would be the most appropriate location, or if it could
be reused in other scenarios.

-- 
João Pedro de Amorim Paula
Computer Science undergraduate at Universidade Federal do Rio Grande do Norte 
(UFRN)
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org