how do you send email from R
up vote
46
down vote
favorite
I want to send emails from R. This is what I have so far:
library(sendmailR)
from <- "eamil@example.com"
to <- "email2@example.com"
subject <- "Performance Result"
body <- "This is the result of the test:"
mailControl=list(smtpServer="snmpt server address")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
When I execute this script, my R session hangs. Any ideas what might be happening?
r
|
show 1 more comment
up vote
46
down vote
favorite
I want to send emails from R. This is what I have so far:
library(sendmailR)
from <- "eamil@example.com"
to <- "email2@example.com"
subject <- "Performance Result"
body <- "This is the result of the test:"
mailControl=list(smtpServer="snmpt server address")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
When I execute this script, my R session hangs. Any ideas what might be happening?
r
1
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
1
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
You need to set a validsmtpServer
and valid email address into
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…
– David Arenburg
May 1 '14 at 19:15
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34
|
show 1 more comment
up vote
46
down vote
favorite
up vote
46
down vote
favorite
I want to send emails from R. This is what I have so far:
library(sendmailR)
from <- "eamil@example.com"
to <- "email2@example.com"
subject <- "Performance Result"
body <- "This is the result of the test:"
mailControl=list(smtpServer="snmpt server address")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
When I execute this script, my R session hangs. Any ideas what might be happening?
r
I want to send emails from R. This is what I have so far:
library(sendmailR)
from <- "eamil@example.com"
to <- "email2@example.com"
subject <- "Performance Result"
body <- "This is the result of the test:"
mailControl=list(smtpServer="snmpt server address")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
When I execute this script, my R session hangs. Any ideas what might be happening?
r
r
edited May 12 '15 at 6:25
isomorphismes
4,91184061
4,91184061
asked May 1 '14 at 16:44
user1471980
3,8382493164
3,8382493164
1
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
1
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
You need to set a validsmtpServer
and valid email address into
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…
– David Arenburg
May 1 '14 at 19:15
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34
|
show 1 more comment
1
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
1
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
You need to set a validsmtpServer
and valid email address into
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…
– David Arenburg
May 1 '14 at 19:15
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34
1
1
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
1
1
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
You need to set a valid
smtpServer
and valid email address in to
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…– David Arenburg
May 1 '14 at 19:15
You need to set a valid
smtpServer
and valid email address in to
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…– David Arenburg
May 1 '14 at 19:15
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34
|
show 1 more comment
6 Answers
6
active
oldest
votes
up vote
17
down vote
accepted
I just tried it out, and it worked for me.
My only differences were I used <> for the from and to:
from = "<email1@dal.ca>"
to = "<email2@gmail.com>"
and my mail control was different, I used
control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to getsmtpServer
on Windows
– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
@Duck The mail can be sent through Rxor
Outlook; those options are mutually exclusive.
– isomorphismes
May 13 '15 at 15:09
|
show 1 more comment
up vote
34
down vote
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "YOURUSERNAME@gmail.com",
passwd = "YOURPASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
7
I recieve such an error:Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
add a comment |
up vote
10
down vote
Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient
package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.
Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook
library (RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "Test Subject"
outMail[["body"]] = "Body of email"
outMail$Send()
add a comment |
up vote
2
down vote
library(mailR)
sender <- "abc@gmail.com"
recipients <- c("bcd@gmail.com","xyz@gmail.com")
send.mail(from = sender, to = recipients, subject="Cash_Collected_Bank_transfer",Sys.Date(),"{}", body = Summary1, encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="abc@gmail.com", passwd="abc@1234", ssl=TRUE), authenticate = TRUE, send = TRUE ,attach.files = c(path2),html = TRUE , inline = TRUE )
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
add a comment |
up vote
0
down vote
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
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)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.
add a comment |
up vote
0
down vote
If you prefer an in-house solution with your server, you can call the linux sendmail.
EMAIL <- myEmail@gmail.com
cmd <- 'subject="Info server";body="This is an email"'
cmd <- paste("echo -e "Subject:${subject}n${body}" | /usr/sbin/sendmail -t "", EMAIL, """)
system(cmd)
add a comment |
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
17
down vote
accepted
I just tried it out, and it worked for me.
My only differences were I used <> for the from and to:
from = "<email1@dal.ca>"
to = "<email2@gmail.com>"
and my mail control was different, I used
control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to getsmtpServer
on Windows
– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
@Duck The mail can be sent through Rxor
Outlook; those options are mutually exclusive.
– isomorphismes
May 13 '15 at 15:09
|
show 1 more comment
up vote
17
down vote
accepted
I just tried it out, and it worked for me.
My only differences were I used <> for the from and to:
from = "<email1@dal.ca>"
to = "<email2@gmail.com>"
and my mail control was different, I used
control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to getsmtpServer
on Windows
– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
@Duck The mail can be sent through Rxor
Outlook; those options are mutually exclusive.
– isomorphismes
May 13 '15 at 15:09
|
show 1 more comment
up vote
17
down vote
accepted
up vote
17
down vote
accepted
I just tried it out, and it worked for me.
My only differences were I used <> for the from and to:
from = "<email1@dal.ca>"
to = "<email2@gmail.com>"
and my mail control was different, I used
control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
I just tried it out, and it worked for me.
My only differences were I used <> for the from and to:
from = "<email1@dal.ca>"
to = "<email2@gmail.com>"
and my mail control was different, I used
control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
answered May 1 '14 at 18:23
Sarah
531414
531414
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to getsmtpServer
on Windows
– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
@Duck The mail can be sent through Rxor
Outlook; those options are mutually exclusive.
– isomorphismes
May 13 '15 at 15:09
|
show 1 more comment
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to getsmtpServer
on Windows
– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
@Duck The mail can be sent through Rxor
Outlook; those options are mutually exclusive.
– isomorphismes
May 13 '15 at 15:09
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
Dear @Sarah do you know if your solution works over Windows and Outlook???
– Duck
May 1 '14 at 20:59
2
2
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
I am using Windows (8.1), but I don't use outlook, so I'm not sure about that.
– Sarah
May 2 '14 at 1:13
Thanks @Sarah maybe do you know how to get
smtpServer
on Windows– Duck
May 2 '14 at 13:49
Thanks @Sarah maybe do you know how to get
smtpServer
on Windows– Duck
May 2 '14 at 13:49
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
@Duck What would it mean for R to be able to send mail on Outlook?
– isomorphismes
May 12 '15 at 6:28
1
1
@Duck The mail can be sent through R
xor
Outlook; those options are mutually exclusive.– isomorphismes
May 13 '15 at 15:09
@Duck The mail can be sent through R
xor
Outlook; those options are mutually exclusive.– isomorphismes
May 13 '15 at 15:09
|
show 1 more comment
up vote
34
down vote
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "YOURUSERNAME@gmail.com",
passwd = "YOURPASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
7
I recieve such an error:Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
add a comment |
up vote
34
down vote
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "YOURUSERNAME@gmail.com",
passwd = "YOURPASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
7
I recieve such an error:Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
add a comment |
up vote
34
down vote
up vote
34
down vote
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "YOURUSERNAME@gmail.com",
passwd = "YOURPASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
If you need to be able to use an smtp server with authentication you can use the mailR
package.
For example using gmail's smtp server:
library(mailR)
sender <- "SENDER@gmail.com"
recipients <- c("RECIPIENT@gmail.com")
send.mail(from = sender,
to = recipients,
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name = "YOURUSERNAME@gmail.com",
passwd = "YOURPASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
edited Dec 2 '15 at 13:18
answered May 21 '14 at 21:21
alko989
4,24732050
4,24732050
7
I recieve such an error:Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
add a comment |
7
I recieve such an error:Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
7
7
I recieve such an error:
Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
I recieve such an error:
Error in ls(envir = envir, all.names = private) : invalid 'envir' argument
– Marcin Kosiński
Mar 15 '15 at 16:46
1
1
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
I cannot replicate your error. The code works for me like it is. Consider asking a new question where you describe how to reproduce this error and probably someone will be able to help you. Maybe this helps.
– alko989
Mar 16 '15 at 12:01
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
@MarcinKosinski I got that error as well but then restarted R and it worked for me.
– isomorphismes
May 12 '15 at 6:31
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
Worked so far so good for me, using a corporate Google Apps account. Tks.+1
– Murta
Nov 27 '15 at 16:14
add a comment |
up vote
10
down vote
Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient
package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.
Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook
library (RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "Test Subject"
outMail[["body"]] = "Body of email"
outMail$Send()
add a comment |
up vote
10
down vote
Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient
package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.
Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook
library (RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "Test Subject"
outMail[["body"]] = "Body of email"
outMail$Send()
add a comment |
up vote
10
down vote
up vote
10
down vote
Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient
package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.
Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook
library (RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "Test Subject"
outMail[["body"]] = "Body of email"
outMail$Send()
Sorry for bumping up this thread. If you want to send email from R using Microsoft outlook, below is the way to go using the RDCOMClient
package. I myself spent a lot of time trying to find an answer on this. I thought it would be useful to have this solution too in this thread for users.
Full credit to @agstudy who provided the original solution in this link - Sending email in R via outlook
library (RDCOMClient)
OutApp <- COMCreate("Outlook.Application")
outMail = OutApp$CreateItem(0)
outMail[["To"]] = "test@test.com"
outMail[["subject"]] = "Test Subject"
outMail[["body"]] = "Body of email"
outMail$Send()
edited Nov 13 '17 at 7:39
answered Nov 13 '17 at 7:19
Code_Sipra
455618
455618
add a comment |
add a comment |
up vote
2
down vote
library(mailR)
sender <- "abc@gmail.com"
recipients <- c("bcd@gmail.com","xyz@gmail.com")
send.mail(from = sender, to = recipients, subject="Cash_Collected_Bank_transfer",Sys.Date(),"{}", body = Summary1, encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="abc@gmail.com", passwd="abc@1234", ssl=TRUE), authenticate = TRUE, send = TRUE ,attach.files = c(path2),html = TRUE , inline = TRUE )
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
add a comment |
up vote
2
down vote
library(mailR)
sender <- "abc@gmail.com"
recipients <- c("bcd@gmail.com","xyz@gmail.com")
send.mail(from = sender, to = recipients, subject="Cash_Collected_Bank_transfer",Sys.Date(),"{}", body = Summary1, encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="abc@gmail.com", passwd="abc@1234", ssl=TRUE), authenticate = TRUE, send = TRUE ,attach.files = c(path2),html = TRUE , inline = TRUE )
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
add a comment |
up vote
2
down vote
up vote
2
down vote
library(mailR)
sender <- "abc@gmail.com"
recipients <- c("bcd@gmail.com","xyz@gmail.com")
send.mail(from = sender, to = recipients, subject="Cash_Collected_Bank_transfer",Sys.Date(),"{}", body = Summary1, encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="abc@gmail.com", passwd="abc@1234", ssl=TRUE), authenticate = TRUE, send = TRUE ,attach.files = c(path2),html = TRUE , inline = TRUE )
library(mailR)
sender <- "abc@gmail.com"
recipients <- c("bcd@gmail.com","xyz@gmail.com")
send.mail(from = sender, to = recipients, subject="Cash_Collected_Bank_transfer",Sys.Date(),"{}", body = Summary1, encoding = "utf-8",
smtp = list(host.name = "smtp.gmail.com", port = 465,
user.name="abc@gmail.com", passwd="abc@1234", ssl=TRUE), authenticate = TRUE, send = TRUE ,attach.files = c(path2),html = TRUE , inline = TRUE )
edited Apr 11 '17 at 19:35
vincentmajor
768915
768915
answered Apr 11 '17 at 13:56
Piyush Sharma
211
211
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
add a comment |
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
2
2
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
Although your answer may be correct, it is preferable to add explanatory text to help readers understand your code.
– vincentmajor
Apr 11 '17 at 16:40
add a comment |
up vote
0
down vote
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
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)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.
add a comment |
up vote
0
down vote
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
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)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.
add a comment |
up vote
0
down vote
up vote
0
down vote
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
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)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.
There are two ways to send an email via Gmail, anonymized or authenticated. Here is the code for anonymized:
library(mailR)
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)
Make sure the recipient emails are Gmail too. It most likely goes to the spam folder in the Gmail account so make sure to mark it "not spammed".
You can find more info here.
answered Sep 13 at 19:43
Habib Karbasian
4818
4818
add a comment |
add a comment |
up vote
0
down vote
If you prefer an in-house solution with your server, you can call the linux sendmail.
EMAIL <- myEmail@gmail.com
cmd <- 'subject="Info server";body="This is an email"'
cmd <- paste("echo -e "Subject:${subject}n${body}" | /usr/sbin/sendmail -t "", EMAIL, """)
system(cmd)
add a comment |
up vote
0
down vote
If you prefer an in-house solution with your server, you can call the linux sendmail.
EMAIL <- myEmail@gmail.com
cmd <- 'subject="Info server";body="This is an email"'
cmd <- paste("echo -e "Subject:${subject}n${body}" | /usr/sbin/sendmail -t "", EMAIL, """)
system(cmd)
add a comment |
up vote
0
down vote
up vote
0
down vote
If you prefer an in-house solution with your server, you can call the linux sendmail.
EMAIL <- myEmail@gmail.com
cmd <- 'subject="Info server";body="This is an email"'
cmd <- paste("echo -e "Subject:${subject}n${body}" | /usr/sbin/sendmail -t "", EMAIL, """)
system(cmd)
If you prefer an in-house solution with your server, you can call the linux sendmail.
EMAIL <- myEmail@gmail.com
cmd <- 'subject="Info server";body="This is an email"'
cmd <- paste("echo -e "Subject:${subject}n${body}" | /usr/sbin/sendmail -t "", EMAIL, """)
system(cmd)
answered Nov 19 at 19:07
Xavier Prudent
495522
495522
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f23412265%2fhow-do-you-send-email-from-r%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
It would be awesome know how to solve this problem I always got error trying to use this function @user1471980
– Duck
May 1 '14 at 18:08
1
what's your operating system?
– Matthew Plourde
May 1 '14 at 18:25
Does mailR work using the same config?
– lukeA
May 1 '14 at 18:30
You need to set a valid
smtpServer
and valid email address into
. Not to mention that this is a duplicate stackoverflow.com/questions/2885660/…– David Arenburg
May 1 '14 at 19:15
@Duck sure it works on Windows or any other operating system, you just need an SMTP somewhere, probably not on your machine running R. E.g. you can use your ISP's mail server.
– daroczig
May 5 '14 at 21:34