Closed Anachron closed 6 years ago
you can use different profiles, or use -from ...
Okay the profile works. I just feel it should be a bit simpler to switch mail. Let's say I have 5 email adresses:
something1@domain1
something2@domain1
something1@domain2
something2@domain2
something3@domain3
Now if I want to switch profile I have to type in the full name in from:
.
Is it possible to set aliases maybe? So s1d1
replaces something1@domain1
?
I'm trying this one again with mcom -from
but mcom
does not have any argument for -from
?
https://github.com/chneukirchen/mblaze/blob/master/mcom#L215
I also feel bad for creating x profiles and having to write MBLAZE_PROFILE=xxx
whenever I switch accounts.
mcom -from
works fine here?
Well, what do you propose else?
I wrote a wrapper script to switch the default mailbox of ~/.mblaze/profile
.
#!/usr/bin/env sh
# mfrom: easy from-switcher
acc=$(sed -n '/^account '"${1}"' {$/,/^}$/p' ~/.mailrc | grep 'from' | cut -d '=' -f 2 | cut -d '(' -f 1 | tr -d '"')
test -n "${acc}" && sed -i "s|^Local-Mailbox.*|Local-Mailbox: ${acc}|" ~/.mblaze/profile
It uses ~/.mailrc file to read the account name and will extract the from-address (without names for now as I am not sure its supported in all tools in the toolchain).
Still would be interested to know why mcom -from
will pass whatever arguments directly into the mail-to-address and works for you @chneukirchen.
Edit:
We figured it out,- I was on an old version (0.3.2_1
was newest released but the changes were after).
Edit2:
Here is the script for msmtp
:
#!/usr/bin/env sh
# mfrom: easy from-switcher
acc=$(sed -n "/^account[ ]*${1}$/,/^$/p" ~/.msmtprc | awk '$1 == "from" {print $2}')
test -n "${acc}" && sed -i "s|^Local-Mailbox.*|Local-Mailbox: ${acc}|" ~/.mblaze/profile
I will close this now.
Other suggestion : What about having multiple ~/.mblaze
? ~/.mblaze1, ~/.mblaze2...
And then alias mcom1='MBLAZE=$HOME/.mblaze1 mcom'
.
I think the mfrom command is a more tidy/clean solution! Thanks for your idea though!
I've installed msmtp and mailx and configured ~/.mailrc to have all my 5 email accounts.
How do I for example tell
mcom
which account to use when sending the mail?Edit: Just found out about
https://github.com/chneukirchen/mblaze/blob/master/man/mblaze-profile.5
, I will take a look.