1

I'm trying to use the mailr package in R to send automated emails, and I love how intuitive it is. However, my only hesitation is that I need to put my password directly in my script.


library(mailr)
send.mail(from = "myemail@yahoo.com",
          to = c("myotheremail@gmail.com"),
          subject = "Hi!",
          body = "It's cool sending emails from R!",
          authenticate = TRUE,
          smtp = list(host.name = "smtp.mail.yahoo.com",
                      port = 587,
                      user.name = "myemail@yahoo.com",
                      passwd = "MyCompletelyVisiblePassword",
                      tls = TRUE,
                      sls = TRUE))

Is there a way to hashed passwords in mailr? For instance, I like how you have that option in shinyauthr's check_credentials() function where you read in a column called is_hashed_password = TRUE. That way, I can hash my password using the scrypt package and know that my password is (more) secure.

Is there anything similar to this in mailr, or any other emailing package in R that will work with outlook?

J.Sabree
  • 2,280
  • 19
  • 48
  • Put your password in an environment file identified as `EMAIL_PASSWORD`, and then use `passwd = Sys.getenv("EMAIL_PASSWORD")` Or see one of [these other suggestions for securing credentials in R](https://db.rstudio.com/best-practices/managing-credentials/). – Gregor Thomas Feb 07 '22 at 21:25

0 Answers0