Message Boards Message Boards

Send email in a Wolfram script without manually inputing credentials?

I have a script(.wls) that runs for hours, so I want it to send me an e-mail after the task completes. I plan to use the built-in SendMail function by putting the following code at the end of my script:

SendMail[<|"To"->"name@example.com","Subject"->"task completes"|>,
MailSettings -> <|
"Server" -> "smtp.gmail.com",
"Username" -> "example@gmail.com",
"Password" -> "xxxxx",
"FromAddress" -> "example@gmail.com",
"Signature" -> "gmail",
"EncryptionProtocol" -> "SSL"
|>];

I test this code in a notebook, and it works without asking for my username and password. However, when I run the same code in a script, it still asks me to input username and password in the command line.

I wonder is there a way to send a email in a script without asking me to input the credentials.

POSTED BY: Charles Du

I just found, the above problem only occurs on my mac laptop. The same script works on my linux machine without asking for username and password.

POSTED BY: Charles Du
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract