Hi Prot,
I recently notice that `smtpmail` has not choosing well server info from
`authinfo`. I debug it with `(auth-source-debug t)` and found `user` is
always setting as `nil`, so first matched lines is choosen.
Can you check in your side if smtp server is choosen well based in login
username?
Can you share with me your `auth-source` query?
Regards.
--
Juanjo Presa
https://nadanix.com
> From: Juanjo Presa <juanjo.presa@nadanix.com>> Date: Wed, 11 May 2022 12:27:17 +0200>> Hi Prot,
Hello there!
> I recently notice that `smtpmail` has not choosing well server info from> `authinfo`. I debug it with `(auth-source-debug t)` and found `user` is> always setting as `nil`, so first matched lines is choosen.
I do not retrieve the information from the authinfo file. Instead, I
have this:
(setq smtpmail-default-smtp-server "mail.gandi.net")
(setq smtpmail-smtp-server "mail.gandi.net")
I now notice the doc string of 'smtpmail-default-smtp-server' that it
only makes sense before loading the smtpmail library. So maybe that is
your problem?
> Can you check in your side if smtp server is choosen well based in login> username?
The variables I copied above have the desired values. My email
correspondence seems to work fine. Is there some other place I should
check?
> Can you share with me your `auth-source` query?
My authinfo looks like this:
machine prv port 993 login MAIL password SECRET
machine inf port 993 login MAIL password SECRET
machine pub port 993 login MAIL password SECRET
machine mail.gandi.net port 465 login MAIL password SECRET
machine mail.gandi.net port 465 login MAIL password SECRET
machine mail.gandi.net port 465 login MAIL password SECRET
The second set concerns SMTP. I do not query it, because it is done
automatically.
--
Protesilaos Stavrou
https://protesilaos.com
> From: Protesilaos Stavrou <info@protesilaos.com>> Date: Wed, 11 May 2022 13:46:18 +0300
Thanks for your fast reply.
>> My authinfo looks like this:>> machine prv port 993 login MAIL password SECRET> machine inf port 993 login MAIL password SECRET> machine pub port 993 login MAIL password SECRET>> machine mail.gandi.net port 465 login MAIL password SECRET> machine mail.gandi.net port 465 login MAIL password SECRET> machine mail.gandi.net port 465 login MAIL password SECRET>> The second set concerns SMTP. I do not query it, because it is done> automatically.
Thats right, but how `smtpmail` choose the correct line of that three? I
debug and I believe is using `auth-source`. Am I right?
--
Juanjo Presa
https://nadanix.com
> From: Juanjo Presa <juanjop@gmail.com>> Date: Wed, 11 May 2022 12:52:22 +0200>>> From: Protesilaos Stavrou <info@protesilaos.com>>> Date: Wed, 11 May 2022 13:46:18 +0300>> Thanks for your fast reply.
You are welcome!
>>>> My authinfo looks like this:>>>> machine prv port 993 login MAIL password SECRET>> machine inf port 993 login MAIL password SECRET>> machine pub port 993 login MAIL password SECRET>>>> machine mail.gandi.net port 465 login MAIL password SECRET>> machine mail.gandi.net port 465 login MAIL password SECRET>> machine mail.gandi.net port 465 login MAIL password SECRET>>>> The second set concerns SMTP. I do not query it, because it is done>> automatically.>> Thats right, but how `smtpmail` choose the correct line of that three? I> debug and I believe is using `auth-source`. Am I right?
Yes, I think you are right. I believe it knows from the matching MAIL
fields. For example (space for demo purposes):
machine inf port 993 login testing@sample.tld password SECRET
machine mail.gandi.net port 465 login testing@sample.tld password SECRET
--
Protesilaos Stavrou
https://protesilaos.com
> From: Protesilaos Stavrou <info@protesilaos.com>> Date: Wed, 11 May 2022 14:08:10 +0300>>> Thats right, but how `smtpmail` choose the correct line of that three? I>> debug and I believe is using `auth-source`. Am I right?>> Yes, I think you are right. I believe it knows from the matching MAIL> fields. For example (space for demo purposes):>> machine inf port 993 login testing@sample.tld password SECRET>> machine mail.gandi.net port 465 login testing@sample.tld password SECRET
Thas exactly my guess. But I dont grab why in my config is ignoring MAIL
fields. I can see if debug it:
Sending...
Sending via mail...
auth-source-search: found 1 CACHED results matching (:max 1 :host "smtp.gmail.com" :port "587")
auth-source-search: found 1 CACHED results matching (:host "smtp.gmail.com" :port "587" :user nil :max 1 :require nil :create nil)
Sending email
Sending email done
Doing Fcc...done
Sending...done
--
Juanjo Presa
https://nadanix.com
> From: juanjo.presa@nadanix.com> Date: Wed, 11 May 2022 13:24:43 +0200>>> From: Protesilaos Stavrou <info@protesilaos.com>>> Date: Wed, 11 May 2022 14:08:10 +0300>>>>> Thats right, but how `smtpmail` choose the correct line of that three? I>>> debug and I believe is using `auth-source`. Am I right?>>>> Yes, I think you are right. I believe it knows from the matching MAIL>> fields. For example (space for demo purposes):>>>> machine inf port 993 login testing@sample.tld password SECRET>>>> machine mail.gandi.net port 465 login testing@sample.tld password SECRET>> Thas exactly my guess. But I dont grab why in my config is ignoring MAIL> fields. I can see if debug it:>> Sending...> Sending via mail...> auth-source-search: found 1 CACHED results matching (:max 1 :host "smtp.gmail.com" :port "587")> auth-source-search: found 1 CACHED results matching (:host "smtp.gmail.com" :port "587" :user nil :max 1 :require nil :create nil)> Sending email > Sending email done> Doing Fcc...done> Sending...done
That's strange. If I this this:
(prot-mail-auth-get-field "mail.gandi.net" :user)
It returns the first occurance of the HOST "mail.gandi.net". This means
that the following does return a :user property:
(auth-source-search :host "mail.gandi.net")
What does (auth-source-search :host HOST) do for you?
Also, make sure to double-check your authinfo file: avoid duplicate
entries and make sure everything is correct.
--
Protesilaos Stavrou
https://protesilaos.com
> From: "Protesilaos Stavrou" <no-reply@forwardemail.net>> Date: Wed, 11 May 2022 15:09:36 +0300>>> That's strange. If I this this:>> (prot-mail-auth-get-field "mail.gandi.net" :user)>> It returns the first occurance of the HOST "mail.gandi.net". This means> that the following does return a :user property:>> (auth-source-search :host "mail.gandi.net")>> What does (auth-source-search :host HOST) do for you?
Return the first occurance. No way returns 2nd or 3rd occurence.
I'm reading some docs [1] and seems you need hooks to change the user
on-the-fly. So I suspect your sendmail is using always the first
server. And its working because your SMTP server allows using different
addresess.
Can you check with (auth-source-debug t) ?
> Also, make sure to double-check your authinfo file: avoid duplicate> entries and make sure everything is correct.
Double checked ;)
[1]: https://www.emacswiki.org/emacs/MultipleSMTPAccounts
--
Juanjo Presa
https://nadanix.com
> From: Juanjo Presa <juanjo.presa@nadanix.com>> Date: Wed, 11 May 2022 21:15:51 +0200>> Can you check with (auth-source-debug t) ?
Just did it. I get the same results as you. It seems mine work because
it fundamentally is the same server and domain name.
--
Protesilaos Stavrou
https://protesilaos.com