GithubHelp home page GithubHelp logo

aws-ses-wp-mail's Introduction

AWS SES wp_mail() drop-in
Use AWS SES to send your WordPress emails. Easily.
A Human Made project. Maintained by @joehoyle.

AWS SES is a very simple UI-less plugin for sending wp_mail()s email via AWS SES.

Getting Set Up

Once you have git cloned the repo, or added it as a Git Submodule, add the following constants to your wp-config.php:

define( 'AWS_SES_WP_MAIL_REGION', 'us-east-1' );
define( 'AWS_SES_WP_MAIL_KEY', '' );
define( 'AWS_SES_WP_MAIL_SECRET', '' );
define( 'AWS_SES_WP_MAIL_CONFIG_SET', '' );

If you plan to use IAM instance profiles to protect your AWS credentials on disk you'll need the following configuration instead:

define('AWS_SES_WP_MAIL_REGION', 'us-east-1');
define('AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE', true);

The next thing that you should do is to verify your sending domain for SES. You can do this via the AWS Console, which will allow you to automatically set headers if your DNS is hosted on Route 53. Alternatively, you can get the required DNS records by running:

wp aws-ses verify-sending-domain

Once you have verified your sending domain, you are all good to go!

Note: If you have not used SES in production previously, you need to apply to move out of the Amazon SES sandbox.

Configuration Sets

To better track your mail activity for monitoring or statistics you can use the configuration sets. To enable it you will first need to create your Configuration Set on AWS SES Console and add the configuration set name as the value to the AWS_SES_WP_MAIL_CONFIG_SET constant.

Detailed information on the setup and usage you find here: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/using-configuration-sets.html

Other Commands

wp aws-ses send <to> <subject> <message> [--from-email=<email>]

Send a test email via the command line. Good for testing!

Credits

Created by Human Made for high volume and large-scale sites. We run AWS SES wp_mail() on sites with millions of monthly page views, and thousands of sites.

Written and maintained by Joe Hoyle. Thanks to all our contributors.

Interested in joining in on the fun? Join us, and become human!

aws-ses-wp-mail's People

Contributors

aaronjorbin avatar ferschubert-hm avatar japh avatar joehoyle avatar johnbillion avatar kovshenin avatar loganyott avatar nathanielks avatar rmccue avatar roborourke avatar tareiking avatar

Stargazers

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

Watchers

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

aws-ses-wp-mail's Issues

Docs: explain how the WP-CLI integration works

Nice work: plugin looks great, (even looks like it supports IAM profiles), but I can't figure out how to make the wp commands run.

I'll submit a PR for the README if someone can help me work out how to make the CLI go.

Undefined index: domain

We've just had a client set this up and they are seeing this error:

Notice: Undefined index: domain in /srv/web/app/mu-plugins/vendor/aws-ses-wp-mail/inc/class-wp-cli-command.php on line 47

trigger_error not called correctly?

still getting a notice for trigger_error not being called correctly.

PHP Warning: trigger_error() expects at most 2 parameters, 4 given in /srv/www/webroot/content/hm-platform/plugins/aws-ses-wp-mail/aws-ses-wp-mail.php on line 29 Warning: trigger_error() expects at most 2 parameters, 4 given in /srv/www/webroot/content/hm-platform/plugins/aws-ses-wp-mail/aws-ses-wp-mail.php on line 29

The `pre_wp_mail` filter is not respected

The pre_wp_mail filter was introduced in WordPress 5.7 but this is not in use in this library. This means short-circuiting an email via this filter works on a local development environment (where the default wp_mail() function is in use, but does not work on the cloud environment.

Update AWS sdk as its out of date.

count(): Parameter must be an array or an object that implements Countable in /var/www/wp-content/plugins/aws-ses-wp-mail/lib/aws-sdk/GuzzleHttp/Handler/CurlFactory.php on line 67

Add support for attachments

I looking for the right way to add attachments.
With wp_mail it work great with Gravityforms
With aws-ses-wp-mail it' don't

Encode Unicode site names before sending

In this dropin, we use the site's name in the sender field. For non-English sites, this name may use non-ASCII characters in the Unicode space, however email/MIME is an ASCII-based protocol, so these need to be encoded.

While some mailers handle this encoding automatically, the AWS SendEmail endpoint specifically notes:

The sender name (also known as the friendly name) may contain non-ASCII characters. These characters must be encoded using MIME encoded-word syntax, as described in RFC 2047. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?=.

Attempting to send email right now with these non-ASCII characters causes email to be sent with invalid Unicode characters in some cases, which can also trigger anti-spam functionality.

For example, with a site name of Blog 한국어, this will get mangled to Blog m� if not encoded. We need to encode this to Blog =?UTF-8?B?7ZWc6rWt7Ja0?= before sending, which will then be correctly decoded by clients.

PHP helpfully provides the mb_encode_mimeheader as part of the mbstring extension which will handle this automatically for us, but would mean we rely on mbstring. Unsure if that's an issue or not.

SMTP_FROM and SMTP_NAME

Hello,

Are there any plans to default to the SMTP_FROM and SMTP_NAME if those standard WP environment variables are set?

If not, would you accept a PR?

Thanks,
Paul.

Add support for creating Route53 verification DNS

Would be cool - however it's presumed that the IAM keys that someone defines will only be able to access SES (if they configured it right) so having hte ability to pass a key/secret into this would be handy.

Class 'Aws\Ses\SesClient' not found

Updated wp-config.php and ran composer install; getting this error while testing with wp-cli:

PHP Fatal error:  Uncaught Error: Class 'Aws\Ses\SesClient' not found in /var/www/domain.tld/http/wp-content/plugins/aws-ses-wp-mail/inc/class-ses.php:230

Any ideas what am I doing wrong?

Sending emails manually error out with white screen (but still sends)

I'll use WooCommerce as an example - if I go to any given order, and try to resend order emails (specifically, in my testing, I used WooCommerce Subscription renewal notices), the plugin sends the email, BUT - it errors out, simply printing the email it sent to, but everything else is a white screen as WP crashes, here's the output:

array(1) { [0]=> string(18) "[email protected]" }

If debug mode is on, then it prints this:

Warning: array_merge(): Argument #2 is not an array in /wp-content/plugins/aws-ses-wp-mail/inc/class-ses.php on line 76
and then echoes out the array:
array(1) { [0]=> string(18) "[email protected]" }

AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE is not actually used

The ENV variable AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE doesn't seem to actually be used.

In a test environment keys are used, however deployed onto a shared AWS infrastructure, AWS_SES_WP_MAIL_USE_INSTANCE_PROFILE=false will still lookup the metadata server

Headers should be handled case-insensitively

Not sure what the deal is, but GravityForms sends notifications in plain text format when the drop-in is activated. Seems to be related to the content type headers somehow as they come through as text/plain

BuddyPress support

If I added support for BuddyPress' emails (which were overhauled for the 2.5 release and do not use wp_mail()), would you want that in this plugin?

It'd involve a class and a function; relatively simple.

Gravity Forms HTML email notifications formatting issues and incorrect from email

We use Gravity Forms on our site and use their notifications to send out HTML email notifications upon form submission. We are seeing two different issues when using the AWS SES WP Mail plugin.

  1. The "from" address is not being picked up correctly. In Gravity Forms notifications, it allows you to set the "From Name" and "From Email." When notification is sent from this plugin, the "From Name" is correct, but the "From Email" is not. Regardless of what the "From Email" is, it creates a pseudo email address of the form "[email protected]"

  2. Gravity Forms also uses HTML formatting in its forms notifications. Rather than parsing the HTML formatting, email sent using this SES plugin is showing the raw HTML tags.

I've used other plugins like wpMandrill in combination with Gravity Forms with success, and seems like an important plugin for this mailer to work with. Any ideas? I know that SES supports HTML email, so guessing there is some issue with the format of the API call?

Correct typo in for WP-CLI in the readme

Currently the readme says:

wp aws-ses send-email <to> <subject> <message> [---from-email=<email>]

However the correct command is

wp aws-ses send <to> <subject> <message> [--from-email=<email>]

Fails to use key & secret on local dev environment

Simply specifying the key & secret doesn't work on a local dev environment. You have to either:

a) Have a credentials file in the web server users home directory .aws/credentials

b) Pass a credentials object in the params:

$params['credentials'] => array(
  'key' => $this->key,
  'secret' => $this->secret,
  'token' => '' // Need to fetch a token to use email service, via StsClient
);

Question is do we add code to fetch the token or rely solely on the credentials file approach? Right now the defines don't do anything.

Support Reply-To header

It looks like the Reply-To header is getting lost along the way (set via Gravity Forms in my case)

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.