humanmade / aws-ses-wp-mail Goto Github PK
View Code? Open in Web Editor NEWAn AWS SES wp_mail() drop-in
An AWS SES wp_mail() drop-in
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]" }
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.
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
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.
URL: https://github.com/afragen/github-updater
A simple declaration at the top of the plugin's header works:
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
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.
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
When Amazon SES returns an error, your code uses PHP's trigger_error. However, that function expects two parameters not four, as you are sending.
https://github.com/humanmade/aws-ses-wp-mail/blob/master/aws-ses-wp-mail.php#L29
This results in the following PHP warning: PHP Warning: trigger_error() expects at most 2 parameters, 4 given in /wp-content/plugins/aws-ses-wp-mail/aws-ses-wp-mail.php on line 29
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?
is this what is supposed to show?
wp aws-ses verify-sending-domain
Submitted for verification. Make sure you have the following DNS records added to the domain:
+-------------------------------------------------------+-------+---------------------------------------------------------+
| Domain | Type | Value
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
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
Same as humanmade/S3-Uploads#172
(+ new tagged release)
Bitten by this because my theme depends upon Guzzle too.
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
Clean email subject of line breaks and other content that might cause SES to reject the message.
It looks like the Reply-To
header is getting lost along the way (set via Gravity Forms in my case)
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.
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>]
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.
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]"
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?
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.