With the mailR package (https://github.com/rpremraj/mailR), you could send HTML emails and additionally attach files with ease as below:
send.mail(from = "[email protected]",
to = c("[email protected]", "[email protected]"),
subject = "Subject of the email",
body = "<html>The apache logo - <img src="http://www.apache.org/images/asf_logo_wide.gif"></html>",
html = TRUE,
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "gmail_username", passwd = "password", ssl = TRUE),
attach.files = c("./download.log", "upload.log"),
authenticate = TRUE,
send = TRUE)
Edit (2014-05-13):
mailR has been updated to allow different character encodings. Below is an example to send the message as UTF-8.
send.mail(from = "Sender Name <[email protected]>",
to = "[email protected]",
subject = "A quote from Gandhi",
body = "In Hindi : ???? ?? ?????? ???? ???? ??????? ?? ????? ???
English translation: An ounce of practice is worth more than tons of preaching.",
encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "gmail_username", passwd = "password", ssl = T),
authenticate = TRUE,
send = TRUE)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…