* How to dynamically select msmtp profile when sending a message?
@ 2024-06-12 21:02 Adham Omran
2024-06-13 10:18 ` Arash Esbati
0 siblings, 1 reply; 6+ messages in thread
From: Adham Omran @ 2024-06-12 21:02 UTC (permalink / raw)
To: help-gnu-emacs
I am trying to set up Emacs to send from multiple accounts, but I am
facing two issues.
In my `/etc/msmtprc` configuration I have two accounts.
1. If one if the accounts is named `default` it always uses and never
automatically picks the correct account to send from based on my FROM
header.
2. If I rename `default` to anything else like `personal` Emacs just
fails to find anything to send from and throws
```
sendmail: account default not found in /etc/msmtprc
```
I want to be able to choose what account to send from, I fear this is
somehow hard coded or not under user choice.
Adham Omran
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to dynamically select msmtp profile when sending a message?
2024-06-12 21:02 How to dynamically select msmtp profile when sending a message? Adham Omran
@ 2024-06-13 10:18 ` Arash Esbati
2024-06-13 13:32 ` Adham Omran
0 siblings, 1 reply; 6+ messages in thread
From: Arash Esbati @ 2024-06-13 10:18 UTC (permalink / raw)
To: help-gnu-emacs
"Adham Omran" <lists@adham-omran.com> writes:
> I am trying to set up Emacs to send from multiple accounts, but I am
> facing two issues.
>
> In my `/etc/msmtprc` configuration I have two accounts.
>
> 1. If one if the accounts is named `default` it always uses and never
> automatically picks the correct account to send from based on my FROM
> header.
>
> 2. If I rename `default` to anything else like `personal` Emacs just
> fails to find anything to send from and throws
>
> ```
> sendmail: account default not found in /etc/msmtprc
> ```
>
> I want to be able to choose what account to send from, I fear this is
> somehow hard coded or not under user choice.
This is an example configuration from msmtp webpage[1]:
--8<---------------cut here---------------start------------->8---
# Set default values:
defaults
port 587
tls on
tls_starttls on
# Define a mail account at a freemail service
account freemail
host smtp.freemail.example
from joe_smith@freemail.example
auth on
user joe.smith
# Some other mail service
account company
host mail.company.example
from smithjoe@company.example
auth on
user company12345
# Set a default account
account default : freemail
--8<---------------cut here---------------end--------------->8---
So it should work if you're following the above.
Best, Arash
Footnotes:
[1] https://marlam.de/msmtp/msmtprc.txt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to dynamically select msmtp profile when sending a message?
2024-06-13 10:18 ` Arash Esbati
@ 2024-06-13 13:32 ` Adham Omran
2024-06-13 14:35 ` Arash Esbati
0 siblings, 1 reply; 6+ messages in thread
From: Adham Omran @ 2024-06-13 13:32 UTC (permalink / raw)
To: help-gnu-emacs
Arash Esbati <arash@gnu.org> writes:
> "Adham Omran" <lists@adham-omran.com> writes:
>
>> I am trying to set up Emacs to send from multiple accounts, but I am
>> facing two issues.
> This is an example configuration from msmtp webpage[1]:
> ...
> So it should work if you're following the above.
Hey Arash, thank you for your reply, maybe you missed this part in my
initial message:
>> In my `/etc/msmtprc` configuration I have two accounts.
I already have two accounts setup and working with the command line.
Emacs is where I have issues as it does not select the correct account
from my configuration.
Adham Omran
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: How to dynamically select msmtp profile when sending a message?
2024-06-13 13:32 ` Adham Omran
@ 2024-06-13 14:35 ` Arash Esbati
[not found] ` <871q506apa.fsf@gilgamesh.mail-host-address-is-not-set>
0 siblings, 1 reply; 6+ messages in thread
From: Arash Esbati @ 2024-06-13 14:35 UTC (permalink / raw)
To: help-gnu-emacs
"Adham Omran" <lists@adham-omran.com> writes:
> Hey Arash, thank you for your reply, maybe you missed this part in my
> initial message:
>
>>> In my `/etc/msmtprc` configuration I have two accounts.
Yes, I saw that, but I was just guessing; wrong guess.
> I already have two accounts setup and working with the command line.
> Emacs is where I have issues as it does not select the correct account
> from my configuration.
I also have a multiple mail-account setup with Emacs/Gnus/msmtp and my
understanding was that msmtp chooses the account based on the
mail-address. I use message.el for sending messages with:
(setq message-send-mail-function #'message-send-mail-with-sendmail)
(setq send-mail-function #'message-send-mail-with-sendmail)
(setq sendmail-program "/path/to/msmtp")
(setq message-sendmail-f-is-evil nil)
(setq message-sendmail-envelope-from 'header)
and have no problems. For the last 2 forms, you could do:
(setq message-sendmail-f-is-evil t)
(setq message-sendmail-extra-arguments '("--read-envelope-from"))
which should give the same result. Sorry if I'm still missing
something.
Best, Arash
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-14 5:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-12 21:02 How to dynamically select msmtp profile when sending a message? Adham Omran
2024-06-13 10:18 ` Arash Esbati
2024-06-13 13:32 ` Adham Omran
2024-06-13 14:35 ` Arash Esbati
[not found] ` <871q506apa.fsf@gilgamesh.mail-host-address-is-not-set>
2024-06-13 17:24 ` Arash Esbati
2024-06-14 5:32 ` Bob Newell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).