How to use mailR package?

0 votes
How to use mailR package?
Sep 3, 2019 in Data Analytics by prardhana
401 views

1 answer to this question.

0 votes

Hi Prarthana,

Install mailR and load the package.

install.packages("mailR", dep = T)
library(mailR)

Next, follow the below format to send mail using SMTP without authentication.

send.mail(from = "sender@gmail.com",
          to = c("Recipient 1 <recipient1@gmail.com>", "recipient2@gmail.com"),
          cc = c("CC Recipient <cc.recipient@gmail.com>"),
          bcc = c("BCC Recipient <bcc.recipient@gmail.com>"),
          subject = "Subject of the email",
          body = "Body of the email",
          smtp = list(host.name = "aspmx.l.google.com", port = 25),
          authenticate = FALSE,
          send = TRUE)

To send a mail with authentication using SMTP, follow the below format.

send.mail(from = "sender@gmail.com",
          to = c("recipient1@gmail.com", "Recipient 2 <recipient2@gmail.com>"),
          replyTo = c("Reply to someone else <someone.else@gmail.com>")
          subject = "Subject of the email",
          body = "Body of the email",
          smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "gmail_username", passwd = "password", ssl = TRUE),
          authenticate = TRUE,
          send = TRUE)

In the above two formats of Sendmail, the structure follows the same as every email i.e from, to, cc, bcc, subject, body.

smtp port and host differs in both the formats due to authentication and other factors.

answered Sep 4, 2019 by anonymous
• 32,460 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

How to use dplyr functions such as filter() inside nested data frames with map()

You can use map() call as follows:  map(full, ...READ MORE

answered Apr 6, 2018 in Data Analytics by Sahiti
• 6,290 points
939 views
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 5, 2019 in Data Analytics by anonymous
6,419 views
0 votes
1 answer

How to install an R package from source?

If you have your file located locally ...READ MORE

answered Apr 13, 2018 in Data Analytics by CodingByHeart77
• 3,710 points
95 views
0 votes
0 answers

Error installing mailR package.

Error installing mailR package. Below error in console. ...READ MORE

Sep 3, 2019 in Data Analytics by nitya
64 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
518 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
318 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points
131 views
0 votes
1 answer

How to use add_tally() and add_count()

Hey, add_tally and add_count returns the count of ...READ MORE

answered Sep 10, 2019 in Data Analytics by Cherukuri
• 32,460 points
490 views
0 votes
1 answer

How to use plyr and dplyr functions inside one source file?

Hi, Lakshmi, Use dplyr::function( ) or plyr::function( ). Since ...READ MORE

answered Aug 25, 2019 in Data Analytics by anonymous
• 32,460 points
51 views