mardi 3 février 2015

R: mailR problems in sending emails using R installed in AWS

I have R installed in AWS, and I connect to a ubuntu DB instance to build my code.


Everything works fine when I test my code. However, I run into a problem at the end of my code. It can't send an email using mailR package.


It says, "Error in switch(encoding, iso-8859-1 = { : EXPR must be a length 1 vector". When I try to put the encoding iso-8859-1, it says,"Error in attach.files[i] : object of type 'closure' is not subsettable."


My code is:



require("mailR")
send.mail(from = "username1@gmail.com",
to = "username2@gmail.com",
subject = "Your Report",
body = "

<html>
<body>

<h1>Your Report</h1>
<p align=right>For May 31 to Jun 06, 2015</p>

<p align=center>

<img src=\"/home/ubuntu/rscripts/LogoType.jpg\">

</p>

</body>
</html>",
html = TRUE,
inline = TRUE,
encoding= "iso-8859-1",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name ="username1@gmail.com", passwd = "password", ssl = TRUE),
authenticate = TRUE, send=TRUE, debug)


Any help will be highly appreciated.


Thanks,


Jean


Aucun commentaire:

Enregistrer un commentaire