How to use mailR package?

0 votes
How to use mailR package?
Sep 3 in Data Analytics by prardhana
12 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 by anonymous
• 27,960 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 darklord
• 6,170 points
275 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 in Data Analytics by anonymous
3,137 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,690 points
56 views
0 votes
0 answers

Error installing mailR package.

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

Sep 3 in Data Analytics by nitya
10 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
105 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
134 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
78 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 in Data Analytics by Cherukuri
• 27,960 points
25 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 in Data Analytics by anonymous
• 27,960 points
16 views