Giter VIP home page Giter VIP logo

aws.ses's Introduction

AWS SES Client Package

aws.ses is a simple client package for the Amazon Web Services (AWS) Simple Email Service (SES) API, which can be used to send email messages.

To use the package, you will need an AWS account and to enter your credentials into R. Your keypair can be generated on the IAM Management Console under the heading Access Keys. Note that you only have access to your secret key once. After it is generated, you need to save it in a secure location. New keypairs can be generated at any time if yours has been lost, stolen, or forgotten. The aws.iam package profiles tools for working with IAM, including creating roles, users, groups, and credentials programmatically; it is not needed to use IAM credentials.

A detailed description of how credentials can be specified is provided at: https://github.com/cloudyr/aws.signature/. The easiest way is to simply set environment variables on the command line prior to starting R or via an Renviron.site or .Renviron file, which are used to set environment variables in R during startup (see ? Startup). They can be also set within R:

Sys.setenv("AWS_ACCESS_KEY_ID" = "mykey",
           "AWS_SECRET_ACCESS_KEY" = "mysecretkey",
           "AWS_DEFAULT_REGION" = "us-east-1",
           "AWS_SESSION_TOKEN" = "mytoken")

Code Examples

The package does not yet support all SES functionality, but does provide the basic mechanisms for verifying a sender email address (i.e., your email) and sending messages once that sender address has been verified.

# setup/verify email address
verify_identity("[email protected]")

# check verification status
get_verification_attrs("[email protected]")

# send an email
## simple plain-text email
send_email("Test Email Body", subject = "Test Email", 
           from = "[email protected]", to = "[email protected]")

# html and plain text versions
send_email(message = "Plain text body", html = "<div><p style='font-weight=bold;'>HTML text body</p></div>", 
           subject = "Test Email", 
           from = "[email protected]", to = "[email protected]")

Messages can be sent to up to 50 recipients, using any combination of To, CC, and BCC forms.

Installation

CRAN Downloads Travis Build Status codecov.io

This package is not yet on CRAN. To install the latest development version you can install from the cloudyr drat repository:

# latest stable version
install.packages("aws.ses", repos = c(cloudyr = "http://cloudyr.github.io/drat", getOption("repos")))

Or, to pull a potentially unstable version directly from GitHub:

if (!require("remotes")) {
    install.packages("remotes")
}
remotes::install_github("cloudyr/aws.ses")

cloudyr project logo

aws.ses's People

Contributors

leeper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aws.ses's Issues

User AWS region and SES AWS region aren't always the same

In the http.R file and its sesPost() function, there need to be two different region variables, one for the AWS region of the user's instance, which is incorporated into the credentials, and one for the region of the user's Amazon SES server, which is incorporated into the URL that the request gets sent to, If both are in us-east-1 the code as currently written works fine. In my case, my instance is in us-east-2 and my SES server is in us-east-1, so the code fails.

When region is set to us-east-1, my error is: In sesPOST(body = query, ...) : Forbidden (HTTP 403). which I'm guessing means a bad signature.

When region is set to us-east-2, my error is Could not resolve host: email.us-east-2.amazonaws.com

Amazon only has SES servers in three regions: us-east-1, us-west-2, and eu-west-1, while it has at least 15 user regions, so the code is likely to fail for many. You can select which of the three regions you want to use in the SES Console (look in the upper-right corner).

I have never successfully formed an AWS signature on my own, so I really appreciate this package. But, for example, in creating the Sig at line 44 (of http.R), I think the region variable at line 46 needs to be the region of the user's instance, and the region variable in line 51 needs to be the region of the user's SES server.

Tom

replyto causes error

The following works:

send_email("Test Email Body", subject = "Test Email", 
             from = "[email protected]", to = "[email protected]")

Adding replyto fails

send_email("Test Email Body", subject = "Test Email", 
             from = "[email protected]", to = "[email protected]", replyto="[email protected]")

With this warning:

Warning messages:
1: In sesPOST(body = query, ...) : Bad Request (HTTP 400).
2: In structure(r[["SendEmailResponse"]][["SendEmailResult"]][["MessageId"]],  :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
packageVersion('aws.ses')
[1] ‘0.1.4’

AWS STS tokens are not used properly in `sesHTTP`

The session_token in sesHTTP is not being read from locate_credentials or environment like it should, and default arg value is NULL which is causing temporary credentials to not work.

More details at cloudyr/aws.signature#19 (comment)

It does work in s3HTTP and cloudwatchHTTP, since it is using session_token = Sys.getenv("AWS_SESSION_TOKEN") in the argument list.

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.