user2913919
user2913919

Reputation: 21

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 = "[email protected]",
    to = "[email protected]",
    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 ="[email protected]", passwd = "password", ssl = TRUE),
    authenticate = TRUE, send=TRUE, debug)

Any help will be highly appreciated.

Thanks,

Jean

Upvotes: 2

Views: 269

Answers (1)

Rahul Premraj
Rahul Premraj

Reputation: 1595

The debug parameter in your function call has no value. Either remove it or set it to TRUE/FALSE. It should fix your issue.

Upvotes: 1

Related Questions