I want to send emails from R. This is what I have so far:
library(sendmailR) from <- "[email protected]" to <- "[email protected]" subject <- "Performance Result" body <- "This is the result of the test:" mailControl=list(smtpServer="snmpt server address") sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
When I execute this script, my R session hangs. Any ideas what might be happening?
It's a wrapper around Apache Commons Email, an email library built on top of the Java Mail API. Due to this, mailR has a dependency on the rJava package, a low-level interface to Java VM. This requires Java Runtime Environment to be installed.
You'll see "via" and a website name next to the sender's name if: The domain it was sent from doesn't match the domain in the "From:" address. For example, you got an email from [email protected], but it could've been sent through a social networking site and not Gmail.
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR) sender <- "[email protected]" recipients <- c("[email protected]") send.mail(from = sender, to = recipients, subject = "Subject of the email", body = "Body of the email", smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "[email protected]", passwd = "YOURPASSWORD", ssl = TRUE), authenticate = TRUE, send = TRUE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With