Hi,
I am trying to send an email through gmail or outlook from my Windows PC and
finding trouble to send the email.
The code which I am using is given below:
Code :
library("sendmailR")
from <- "abcd@outlook.com"
to <- <mailto:efgh@gmail.com> efgh@gmail.com
subject <- "Run at"
mailControl = list(smtpServer="blu-m.hotmail.com")
attachment <- "type_1.pdf"
attachmentName <- "target_score.pdf"
attachmentObject <- mime_part(x= attachment,name= attachmentName)
body <- "Email Body"
bodywithAttachement <- list(body, attachmentObject)
sendmail(from=from,to=to,subject=subject,msgbodywithAttachement,control=mailControl)
However it gives me following Error:
Error:
Error in socketConnection(host = server, port = port, blocking = TRUE) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = server, port = port, blocking = TRUE) :
blu-m.hotmail.com:25 cannot be opened
I have also tried the other library i.e. mail but it does not support
attaching the object.
And also tried it with following command which was also unfruitful with
password given.
Code :
sendmail(from=" efgh@gmail.com <mailto:efgh@gmail.com> ",
to="
efgh@gmail.com <mailto:efgh@gmail.com%22,%20text=%22Send> ",
text="Send
Email", subject="MAil", smtp="smtp.gmail.com", user=
"efgh@gmail.com",
pw="pwd")
Error:
Error in socketConnection(host = server, port = port, blocking = TRUE) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = server, port = port, blocking = TRUE) :
localhost:25 cannot be opened
Please let me know if we have some solution for this.
Best Regards,
Bhupendrasinh Thakre
[[alternative HTML version deleted]]