Giter VIP home page Giter VIP logo

sendmailr's Introduction

sendmailR

OSS Lifecycle CRAN status CRAN Downloads CRAN Downloads

Package contains a simple SMTP client with minimal dependencies which provides a portable solution for sending email, including file attachments and inline html reports, from within R. SMTP Authentication and SSL/STARTTLS is implemented using curl.

Usage

from <- sprintf("<sendmailR@@\%s>", Sys.info()[4]) 
to <- "<olafm@@datensplitter.net>" 
subject <- "Hello from R" 
body <- list("It works!", mime_part(iris)) 
sendmail(from, to, subject, body, 
  control=list(smtpServer="ASPMX.L.GOOGLE.COM")) 

# With authentication and SSL
sendmail(from="[email protected]", 
  to=c("[email protected]","[email protected]"), 
  subject="SMTP auth test", 
  msg=mime_part("This message was send using sendmailR and curl."), 
  engine = "curl", 
  engineopts = list(username = "foo", password = "bar"), 
  control=list(smtpServer="smtp://smtp.gmail.com:587", verbose = TRUE) 
)

Install from github

To install the bleeding edge version from GitHub using devtools:

library("devtools")
install_github("olafmersmann/sendmailR")

Or using pak:

library("pak")
pkg_install("olafmersmann/sendmailR")

sendmailr's People

Contributors

areedv avatar innir avatar mariusbarth avatar ndevln avatar olafmersmann avatar qsweber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sendmailr's Issues

Email body as attachment

Hi,

I've been using your package for a while to send emails with HTML body and PDF attachments for a while now. I updated R last week and found that the body is now sent as an attachment too...

I assume that somewhen recently the disposition argument to mime_part has stopped working correctly?

This is essentially the code i've been using...

sendmailR::sendmail(from = address,
                      to = recipient,
                      subject = subject,
                      msg = list(sendmailR::mime_part(emailbody,
                                                      type = "text/html",
                                                      disposition="inline"),
                                 sendmailR::mime_part(pdfoutfile,
                                                      name = pdf_name)),
                      control = smtp_settings)

Name of sender in From parameter

Hi,

I'm using your package for sending emails to a database of customers. I'd like to have the name of the sender (From parameter) appear in the customer's inbox but I can't seem to make it work. If I use only the sender's email address then it works fine.
This is what I've tried so far:

But I keep getting a 501 error from the smtp server. Am I missing something? or is it a problem on the SMTP server itself while handling the message through curl?

Thanks for your help

Setting the MIME type in mime_part() for files does not work

Hi,

while the method mime_part.character() has a parameter type it is not passed down to .file_attachment() in https://github.com/olafmersmann/sendmailR/blob/main/R/mime_part.R#L210:

> attachment <- sendmailR::mime_part("/etc/group", "group", type = "text/plain") 
> attachment$headers$`Content-Type`
[1] "application/octet-stream"

vs.

> attachment2 <- sendmailR:::.file_attachment("/etc/group", "group", type = "text/plain")
> attachment2$headers$`Content-Type`
[1] "text/plain"

I didn't open a PR because it's not completely obvious how to handle this. One idea would be to use the package mime to guess the MIME type of the file.

Using "UTF-8" as default encoding causes sendmailR to fail

The minimum reproducible example:

  1. Start a new R session, do the following:
    library(sendmailR)
    sendmail(from = "<[email protected]>", to = "<[email protected]>", subject = "Test", msg = mime_part("Body text"), control=list(smtpServer="ASPMX.L.GOOGLE.COM", smtpPort="25"))
    Email will be sent successfully.
  2. Set options(encoding = "UTF-8") and try to send email from 1 once again. Result: Error in if (code == lcode) { : argument is of length zero mistake appears.

My default language settings are "English_United States.1252".

next InitializeSecurityContext failed : SEC_E_CERT_EXPIRED (0x80090328)

Hi Olaf! Thank you for you work developing this package.
I encouneterd an issue when implementing package for sending reports.
I wrote a piece of code that worked perfectly well at 11:00
The same piece of code end stopped working with the following error today at 13:00:

Error in curl_fetch_memory(smtp_server, handle = h) :
schannel: next InitializeSecurityContext failed: SEC_E_CERT_EXPIRED (0x80090328)

Could you please help with this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.