How to use mailR package

0 votes
How to use mailR package?
Sep 3, 2019 in Data Analytics by prardhana
1,905 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
• 33,030 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,370 points
4,683 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 6, 2019 in Data Analytics by anonymous
14,090 views
0 votes
1 answer

How to install an R package from source?

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

answered Apr 14, 2018 in Data Analytics by CodingByHeart77
• 3,750 points
912 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
878 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
2,250 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
1,920 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

edited Jun 9, 2020 by Gitika 1,182 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
• 33,030 points
4,764 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 26, 2019 in Data Analytics by anonymous
• 33,030 points
704 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP