Using Fastmail aliases with Mu4e & mbsync.

192 views
Skip to first unread message

Tushar Tyagi

unread,
Jan 1, 2019, 10:18:45 PM1/1/19
to mu-discuss
Hello,

I am using the combination of mu4e & mbsync to manage my emails. As of
now I've set it up with two accounts: gmail & fastmail and it works
really well.

Fastmail provides aliases which are just extra email addresses one can
register, and anything which comes to these gets delivered onto the
primary email address.

My use case is to fetch the emails gmail, fastmail primary & fastmail
aliases. Then reply via the same address that had got the email. For
example, replying to a mailing list using the alias that I've setup
specifically for mailing lists.

I think that adding an entry for an alias in mbsyncrc is going to
duplicate the messages and perhaps mess up the existing emails that I
have. Maybe I can do something from mu4e based on the message headers?

I wanted to know if anyone has setup something like this? Basically
multiple "redirect" email addresses. Any pointers or example
configuration will be highly appreciated.

--
With best regards,
Tushar

Vladimir Sedach

unread,
Jan 9, 2019, 2:10:45 PM1/9/19
to mu-di...@googlegroups.com
Hi Tushar,

You can set the From: header when composing a reply using
MU4E-COMPOSE-PRE-HOOK. Here is how I use it to manage mail
forwarding:

(setq my-mail-aliases
'(("vse...@common-lisp.net" "v...@oneofus.la" "Vladimir Sedach")))

(add-hook 'mu4e-compose-pre-hook
(cl-defun my-set-from-reply-address ()
(cl-flet ((set-reply-address (address name)
(setq user-mail-address address
user-full-name name)
(cl-return-from my-set-from-reply-address)))
(when mu4e-compose-parent-message
(dolist (x my-mail-aliases)
(when (mu4e-message-contact-field-matches
mu4e-compose-parent-message :to (first x))
(set-reply-address (second x) (third x)))))

(set-reply-address "v...@oneofus.la" "Vladimir Sedach"))))

This does the *opposite* of what you are asking (I want to set From:
on replies to messages that come To: vse...@common-lisp.net to
v...@oneofus.la because I cannot send mail from the common-lisp.net
domain), but I hope it is clear how to use the hook and header
accessors to do what you need.

Vladimir

Mekeor Melire

unread,
Apr 10, 2020, 6:43:04 AM4/10/20
to mu-di...@googlegroups.com
Hello Tushar,

could you solve the issue you described? I came up with the same issue
and would be glad to know how you solved it.

With best regards,
Mekeor
--
mekeor ~ EDD3 DFFA 76F6 11C0 145F 9A99 AC85 BAD8 A2F8 C868

Marcel van der Boom

unread,
Apr 10, 2020, 11:58:31 AM4/10/20
to mu-di...@googlegroups.com

I've recently resolved a similar issue using contexts.

( see:
https://groups.google.com/forum/#!topic/mu-discuss/Ts_wa8fsT-Y
)


Somthing like this:

(setq
mu4e-context-policy 'pick-first
mu4e-compose-context-policy 'pick-first

mu4e-contexts
`(,(make-mu4e-context
:name "Default"
:vars `((user-mail-address . "def...@example.com")))
,(make-mu4e-context
:name "Alias1"
:match-func (lambda (msg)
(when msg
(mu4e-message-contact-field-matches
msg `(:to :cc :from) "ali...@example.com")))
:vars `((user-mail-address . "ali...@example.com")))))


This would cause replies to come from 'ali...@example.com' when
the original message was sent to that address and use
'def...@example.com' as from address otherwise.

Hope this helps,

marcel

[Mekeor Melire]:

> could you solve the issue you described? I came up with the same
> issue and would be glad to know how you solved it.


Mekeor Melire

unread,
Apr 4, 2021, 7:58:21 PM4/4/21
to mu-di...@googlegroups.com
Thank you very much, Marcel! This solved my problem. (I needed to keep
the smtpmail-smtp-user of the original mail-addresses' context though.)


2020-04-10 / 17:58 / mu-di...@googlegroups.com:
Reply all
Reply to author
Forward
0 new messages