0

I am trying to send email from R using MailR package. This works awesome when I try on my personal gmail account. But when I try to run same with my corporate mail id, it doesn't work. One problem I found is because of 2 step authentication. I have removed 2 step authentication for my personal mail account but unable to for my corporate account. Is there any way I can include a password or authentication in mailR package code?

My code:

library(rJava)
library(mailR)
send.mail(from = "emailid",
          to = "emailid",
          subject = "Subject of the email",
          body = "Please find the attached doc having cluster report",
          html = TRUE,
          smtp = list(host.name = "smtp.gmail.com",port = 465, user.name="emailid", passwd="*******",ssl = TRUE),
          attach.files ="./Prod tracker-new Jul28-Aug2.csv",
          authenticate = TRUE,
          send = TRUE)
Clemsang
  • 5,053
  • 3
  • 23
  • 41
Swetha K V
  • 43
  • 1
  • 6
  • Maybe this helps: http://stackoverflow.com/questions/24985340/non-interactive-passwords-in-r – sebolus Aug 10 '16 at 09:07
  • To add to @sebolus comment: Gmail allows to set up passwords for specific applications, see here https://support.google.com/accounts/troubleshooter/3141849?hl=en#ts=3202254%2C3202256, so if you can do the same for the corporate mail that may be the answer. – m-dz Aug 10 '16 at 09:32
  • I have tried set up a password in gmail. But I could not find R application to set. Rather I have set password for my system. – Swetha K V Aug 12 '16 at 05:29
  • I am able to send mail using a different hot name which my company has for sending mails. But this problem of dual authentication, I still could not find a valid answer – Swetha K V Aug 12 '16 at 06:12

0 Answers0