I am looking to have a program that can shift between a few different email accounts and am personally storing credentials. I noticed that:
SendMail[<|"To" -> "***@***.***",
"Subject" -> "SubjectForEmail",
"Body" -> "SomeText", "From" -> "***@***.**",
"Server" -> "smtp.***.***", "UserName" -> "***@***.**",
"Password" -> "***", "PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"|>]
Works great. However:
SendMail[Join[<|"To" -> "***@***.***",
"Subject" -> "SubjectForEmail",
"Body" -> "SomeText", "From" -> "***@***.**",
"Server" -> "smtp.***.***", "UserName" -> "***@***.**",
"Password" -> "***", "PortNumber" -> 587,
"EncryptionProtocol" -> "StartTLS"|>]]
Fails every time and asks for me to sign in with a Wolfram account (obviously ignoring the parameters that it was given)
Note:
Join[<||>]//Head
-> Association
<||>//Head
-> Association
It's the same type and has the same contents. SendMail[] just doesn't like it after it is Join[]ed.
Have I missed something in the SendMail[] or Join[] documentation? Is this something special about Associations?
Any help is appreciated.
EDIT:
After goofing around with this, I figured out that SendMail[#]& @ Join[<|...|>]
works for some reason. (Note: SendMail @ Join[<|...|>]
does not work)
I'm not marking this as answered yet because I have absolutely no idea why this solution works and would appreciate any insight you might have.
Identity
instead ofJoin
? What happens if you doSendMail[Evaluate[Join[...]]]
? $\endgroup$Identity
butSendMail[Evaluate[Join[...]]]
seems to work. I think that solves it. I had no idea that SendMail[] might hold the evaluation. $\endgroup$