Closed codesoap closed 5 years ago
Easiest way is to use multiple profile files.
Thanks for the tip! I guess then I'll write a little script that swaps my profiles quickly.
I did the same, called it mfrom and works msmtp. If you need help feel free to reply.
Edit: Here is the script: https://github.com/Anachron/void/blob/master/exe/mfrom
Thanks for the input, @Anachron! I've chosen not to modify the mblaze profile, but to link it to different profiles. Thus I've written my own little script.
If anyone is interested, I'll append the script. I call it macc
. For it to work you have to use msmtp and provide different ~/.mblaze/profile_<YOUR_PROFILE>
files. Note that <YOUR_PROFILE>
needs to be the same name as the profile in your ~/.msmtprc
.
#!/usr/bin/env sh
# Change the mail account via which mails are sent.
if [ $# -ne 1 ]; then
echo "Please give exactly one argument: A regex matching the desired account"
exit 1
fi
# Select the desired account from the ones available
available_profiles=$(ls $HOME/.mblaze/profile_* | xargs -I '{}' -n1 \
sh -c 'basename "{}" | cut -d_ -f2-')
selected_profile=$(echo "$available_profiles" | grep "$1")
if [ -z "$selected_profile" ]; then
echo "No profiles match the regex. Aborting..."
exit 1
elif [ $(echo "$selected_profile" | wc -l) -ne 1 ]; then
echo "Multiple profiles match the regex. Aborting..."
exit 1
fi
echo "Selected profile '$selected_profile'."
# Change the default msmtp account
# Careful! For this to work the name of your profile needs to match the
# profile in '~/.msmtprc'.
echo "Updating default account in '$HOME/.msmtprc'."
sed -i "s/\(^account default[[:space:]]*:\).*/\1 $selected_profile/" \
$HOME/.msmtprc
# Switch the mblaze profile
# This will overwrite '~/.mblaze/profile'!
echo "Updating '$HOME/.mblaze/profile'."
ln -sf "$HOME/.mblaze/profile_$selected_profile" "$HOME/.mblaze/profile"
You're welcome! This issue can be closed then, no?
I guess so. Maybe in the long run some tool similar to our's should be added to mblaze...
@codesoap that will be very, very hard. There are tons and tons of email setups, some wont even use outgoing mail with mblaze. I don't really know how you would ship something default when even between our solutions there is a big difference, because my solution just modifies the mblaze-profile and yours toggles between multiple profiles. And both require msmtp
.
It would be really nice if I could specify different
Outbox
values for different mail accounts in my~/.mblaze/profile
.Is my understanding correct, that currently all mail I write will be saved in the same
Outbox
-maildir, no matter what thefrom
address was? How do you deal with this?