Git Product home page Git Product logo

wordpress-sparkpost's Introduction

WordPress SparkPost

Use SparkPost emails right from your WordPress site.

Travis CI Coverage Status

Installation

Option 1

  • Download the plugin from WordPress's plugins repository.
  • Upload to plugins directory of your WordPress installation which, usually, is wp-content/plugins.
  • Activate the plugin from admin panel.

Option 2

  • From your WordPress site's admin panel go to Plugins -> Add New.
  • Enter sparkpost in Search Plugins text field and hit Enter.
  • It should show pluging titled SparkPost SMTP. Click Install Now button.
  • In next page, upon successful downloading click Activate Plugin.

Configuration

Once plugin is installed, you need some quick but important configuration. Click SparkPost SMTP from Settings menu

  • In the form put SparkPost API key, sender name and email.
  • Click Save Changes

Test Email

From Test Email section, try sending a test email to yourself to make sure the credentials are working fine.

Development

  • Install WordPress
  • Clone this repository to the WordPress plugins directory:
git clone [email protected]:SparkPost/wordpress-sparkpost.git ~/src/wordpress/wp-content/plugins/wordpress-sparkpost
  • Activate the plugin from admin panel

Running Tests

  • Make sure you're using PHP 5.6 or above.
  • Go to ./tests directory.
  • Install test files by running bash bin/install-wp-tests.sh wordpress_test root '' localhost latest (Try 127.0.0.1 instead of localhost if you're getting error). Details on wp-cli.org.
  • Install composer
  • Run composer install to install required packages.
  • To run tests, run composer test.
  • Add your tests in tests/specs directory. Upon pushing the branch, Travis will automatically run it and generate reports (tests and coverage).

Releasing

  • Create a branch off master: git checkout -b bump
  • Update the version in plugin meta and WPSP_PLUGIN_VERSION constant in wordpress-sparkpost.php
  • Update the version and change log in readme.txt
  • Commit the changes and push the branch
  • Create a pull request
  • Once the pull request is merged, run ./deploy.sh

wordpress-sparkpost's People

Contributors

avigoldman avatar bkemper avatar carloslevir avatar d4mation avatar dlmartin avatar ewandennis avatar janneleppanen avatar jgzamora avatar michael-mader avatar ntwb avatar rajumsys avatar richleland avatar thehungrycoder avatar trys avatar xoref avatar

Stargazers

 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

wordpress-sparkpost's Issues

Add hook for main content

because now we allowed to modify tag name, i think we need to support a hook for body like

$body['substitution_data'][$content_substitution_tag_name] = apply_filters('HOOK_NAME', $this->Body);

otherwise, people will be in trouble to modify the value if some other hooks change tag content to something else

Not compatible with contact form plugins

We've at least two customers complaining about that our wordpress plugin is not working nicely with other wordpress plugins like contact-form-7, gravity forms etc.
We need to figure out the reason and fix it if it's fault of our plugin.

mailer.http.class.php issue?

Hello -
Please let me know if this is not the appropriate place for this question. I do not know if this is truly an "issue with your plugin" -- although, that is what my host is telling me.
I do not wish to waste your time -- if I need to ask elsewhere, please let me know.

Just as we are deciding that we can make the 'official switch' to SparkPost (from Mandrill) --- today we've begun receiving error notifications from our host / server (and, of course, our host is telling us that the issue is with your plugin):

Warning: First parameter must either be an object or the name of an existing class in . . . . /wp-content/plugins/sparkpost/mailer.http.class.php on line 158

Warning: First parameter must either be an object or the name of an existing class in . . . . /wp-content/plugins/sparkpost/mailer.http.class.php on line 165

Unfortunately, I don't understand what this means --- let alone why it would start happening 'out-of-the-blue' --- I can promise that I have not made any changes to mailer.http.class.php nor any other of the parts of your plugin.
I am happy to provide further info -- anything that might be helpful (?)
We've been using SparkPost for a good week or more -- without receiving these 'warnings' . . . . today, they don't seem to stop.

Any help is very much appreciated. And, again, if this is not the appropriate place for this question, please let me know that.
Thank you, in advance

Chris

Tracking URL replacement

An issue related to the way URLs get replaced with their tracking redirects. Consider the default WP password request plain-text email:

Someone has requested a password reset for the following account:

http://example.com/

Username: USERNAME

If this was a mistake, just ignore this email and nothing will happen.

To reset your password, visit the following address:

<http://example.com/wp-login.php?action=rp&key=KEYKEYKEY&login=USERNAME>

A URL that has a > immediately following it will accidentally encode the > into the tracking redirect URL. In other words, in the above case, the last URL above gets encoded as http://example.com/wp-login.php?action=rp&key=KEYKEYKEY&login=USERNAME> instead of http://example.com/wp-login.php?action=rp&key=KEYKEYKEY&login=USERNAME.

This breaks all the default WP Lost Password emails because for some reason the default template includes brackets around the password reset link.


On another note, I would also say that it can be a bit jarring for users to see the long redirect URLs in a simple plain-text email. This is certainly an argument for an end-user to improve on the default WP emails with better and/or HTML templates, but in the meantime it would be useful to have the option to disable tracking URL replacement from the emails sent by the SparkPost WP plugin.

Sending Domain Troubleshooting

Hey there!

We are transitioning a few of our clients from Mandrill to SparkPost. However, we are have issues verifying one of the sending domains. The SPF record is in place, and I can verify through whatsmydns.net.
screen shot 2016-05-02 at 11 24 27 am
However, it still says the record is not properly configured in the SparkPost web app.

I contacted SparkPost support, and they said that the sending domain IS verified and set up correctly (even though I am still unable to confirm in the app.) So, I attempted to set up SparkPost for the site via the SparkPost WordPress add-on; however, when I tried sending a test email, I received an error message saying that the sending domain is unconfigured / unverified (see screenshot that I sent to SparkPost support).
screen shot 2016-05-02 at 11 20 39 am

Support told me that WordPress is throwing a wrench into troubleshooting and suggested I reach out to the GitHub community for further assistance. So I'm hoping to find help here! :) Anyone have any ideas what could be going on?

A couple things to note:

  • All DNS updates occurred last week, so propagation should not be an issue.
  • I was having sending domain verification issues before I installed and attempted to set up the WordPress add-on. So I'm not convinced that it's a WordPress issue, but SparkPost support seems to think it may be.

Thank you!!

Switch Templates

Does anyone have any code samples for switching templates based on which blog in a multi-site implementation is sending transactional emails?

Thanx in advance for your thoughts ....... Rick

SparkPost doesn't send bbPress subscription notifications -- might be bcc issue??

Currently, this works with Mandrill but does NOT work with SparkPost:

Our website (WordPress) uses bbPress (forum plugin).
It allows members of our site to "Subscribe" to forum topics if they choose.
That works with Mandrill.
It does not work with SparkPost.

Can you help to figure out what SparkPost needs --- so that this will work?

Here is some info that MIGHT be 'helpful' . . .
We had needed to use a workaround ("Sudar-Fix") to make Mandrill work for the subscriptions when bbPress was at an earlier version (I can figure out the exact version, if helpful - let me know).
bbPress has apparently "incorporated" the "Sudar-Fix" into it's core, and we no longer need it, for Mandrill to work with bbPress subscriptions.

SparkPost does not work for bbPress subscriptions -- with or without the Sudar-Fix.

You can find the "Sudar-Fix" here:
http://bulkwp.com/using-wpmandrill-to-send-subscription-notification-from-bbpress/
and github info:
https://github.com/sudar/bbpress-subscription-in-mandrill

It DOES appear that SparkPost DOES work for bbPress subscriptions - when using an old version of bbPress (bbPress 2.5.3) -- but does not work with the current bbPress 2.5.8 -- I do not know for certain, at which version it stopped working, but I can try to determine -- if it might be helpful. (?)

Any advice / help / etc would be GREATLY APPRECIATED!
Please let me know if I can help --- I will try to provide any info that might help!

Thanks in advance,
Chris

SparkPost / Wordpress integration

Hi there,

we are migrating several sites from Mandrill to Sparkpost. We have problem with your plugin since it does not work.

API Connection does not work
We are using API connection and sending domains are enabled in Sparkpost (both SPF and DKIM).

We have enabled Sparkpost and when we send out a test-email (from settings interface with enabled debugging) we got the following message: "Could not instantiate mail function."

WP version: 4.2.2.
PHP 5.5.9
Host: DigitalOcean
Other significant plugins: WooCommerce
NOTE: We do not have any SMTP server installed nor we have declarations made in php.ini

This is quite strange since Mandrill integration was working without problems. And yes, we first disabled Mandrill plugin before enabling Sparkpost plugin.

Contrary to API connection SMTP connection works!
If we select from a drop down SMTP connection if works perfectly fine.

But, we would like to use API connection and not SMTP.

The other problem is more Safari specific: Safari tends to populate the field from_email from overrides section with Wordpress username. This is the result of famous Safari function auto-complete. You should check your code to prevent this.

Matej

Remove support for SMTP

Many issues have been reported via the issue tracker and support related to the SMTP portion of the plugin. I can't think of a reason why we would continue to support SMTP in the plugin when https calls to the API are more broadly supported. There are plenty of awesome SMTP plugins for WordPress. SMTP is also much more chatty than HTTP so at scale it's more efficient to send via HTTP.

I believe we would need to do a major version bump for this.

Support CC, BCC

HTTP Mailer needs to support for Cc and Bcc.

Note: Support for ReplyTo is added in #17 PR.

SMTP Username

Show pre-filled username in ready-only mode (or otherwise convey) the message that user don't need to enter the Username.

It appears customers are getting confused as they think From email field is the field where they have to put the username (SMTP_Injection).

Select a template via the plugin UI

One thing Mandrill gives us is the ability to choose from a list of published templates via the WP plugin UI. This doesn't appear to be an option with the Sparkpost plugin (yet?) and for the moment there isn't a method to set a default template for SMTP sending in the web UI.

Add test email sending

In SparkPost SMTP interface, add capability so user can send a test email to verify that sparkpost credentials are working correctly.

Template overrides "From Email" and "Reply To" headers

I am in the process of migrating from mandrill, however I am having issues with sparkpost:

  1. When creating a template, it asks for a subject line and a "from" address.
  2. When sending emails using sparkpost for wordpress, it takes the subject line set up in the template, which is very useless, as I am using this plugin/service to send transactional messages from my site, and all messages are dynamically generated (subject, from, to) etc.

Suggested New Features

Here are some suggested features for development:

  1. Hook to the message json before sending for modifications similar to wpMandrill's mandrill_payload()
  2. I agree with someone's comment to read/select a default template.
  3. Would be great if we could use something similar to https://mandrill.zendesk.com/hc/en-us/articles/205582117-How-to-Use-SMTP-Headers-to-Customize-Your-Messages
  • Priority would be to choose template (X-MC-Template) and (X-MC-MergeVars) and (X-MC-Metadata)
    Much appreciated.
    /M

Logging transmissions

Plugin should (optionally) support logging of all outgoing transmissions which should log message payload, url, response (including errors), so that when non-test emails do not work, we can inspect the log.

Admin should be able to enable/disable this and should be off by default.

Explain "overrides" section in settings

Directly quoting user from wordpress plugin repo

Suggestion to the developers: In the settings page, please describe the "Overrides" section properly. It is very confusion as to what is it referring to. Will it change the default "Mail From" for WordPress or will it override all "mail-froms" throughout the website.

reply-to has broken

Since the last release, the plugin is no longer correctly including the reply-to header. I see it go out in WP Mail Log, but in the received messages it's absent. It's a huge usability issue for me, a quick fix would be much appreciated!

Bcc header info being overwritten

Similar to the issue with Reply-to, the plugin doesn't seem to work with bcc. I am manually setting the headers before sending with wp_mail but the bcc is not being sent. This was not the case with wpMandrill nor if I have no email plugin installed.

Add version to User Agent header

Like all other client libs, we should add WordPress version number in User Agent string. This may be useful for tracking and reporting.

Setting additional headers

HTTP mailer does not respect additional headers (Reply-To in this case) added by other plugins. In this post, user has reported that though the header is set in the plugin, it's not seen in the email. The following screenshot shows what values are expected in the headers.
https://www.dropbox.com/s/4azi9bsok6zopod/Capture.JPG?dl=0

  • We need to check whether contact-form-7 is correctly setting the headers (in terms of phpMailer)
  • If so, we need to use those values

Sender email is overriden every time

Hi!

We use a form plugin (DHVC Forms) for support requests. We use the form's email address field to replace the sender email and make it easy to reply to.

We had no problem with the sparkpost plugin so far, but for a few weeks (I don't know exactly since when) we reply to our own address when we try to reply to a support question.

I tried to update the plugin, also tried to revert back to previous versions when we used WP 4.4.3.
After that we updated WP to the latest version. 4.6.1.
We still have the issue with the latest version as well.

SESSIONS and blocking

If a site is using PHP $_SESSION's and the sparkpost api is slow to respond this has a blocking effect as the sessions file has been is locked until the script finishes and therefor the user has no access to the site until the email has sent and the sessions file can be closed, worse is if the server times out it can cause a 504 and block the user for a long time or until the user closes and opens the browser to get a new session because his original sessions file on the server is still locked.

The solution would be to check if a session exists and if so close the session "session_write_close()" immediately before sending the email and then open it again after.

If any clarification is needed please let me know, this was a big problem for us and hard to track down.

Replace CR/LF

Seeking a way to replace CR/LF in transactional email with <br />. My current solution is to modify line 96 in mailer.http.class.php, not sustainable. Hoping the plugin can be enhanced or someone can suggest a filter for functions.php.

Thank you ...... Rick

Forgot Password email mangled

Currently the plugin is mangling the "forgot password" email, mainly the URL. Is there a way to filter the sending email to allow for HTML email instead of plaintext, or to apply some filters to control the output before processing?

not work with Contact Form 7

I used mandrillapp plugin with WordPress and easily send email through my website.
So I removed the mandrillapp plugin and installed sparkpost. I activated the API Key and sender e-mail, but now appears message "not send" the submission form.
The plugin sending test works correctly.

I tried habilitat SMTP 587 and 2525, but also does not work.

Can you guide me?

Add support for using http API

In some shared host port 587 (or 2525) may be blocked. In that case customers can't send email using SMTP.

We can support transmission using our API so that it can talk in generic ports.

Support action hooks, filters

Plugins needs to support hooks/filters so that other plugins or scripts can modify the behaviour without modifying the source of this plugin.

Improve language in overrides section

From the user sumeetchawla on the WP forums:

Suggestion to the developers: In the settings page, please describe the "Overrides" section properly. It is very confusion as to what is it referring to. Will it change the default "Mail From" for WordPress or will it override all "mail-froms" throughout the website.

Inlining CSS

Hey there, I was directed here by support for this question..
But does the wordpress plugin support inlining by default?

We have some custom templates with CSS in the head, just checking whether the plugin will automatically inline that css?

Using this as an example it seems like it would be easy:
https://www.sparkpost.com/blog/automatic-css-inlining-sparkpost/#.V2yBTZN94UE

But at the moment I don't think the css is being inlined..

Cheers,
Tim

Override mailSend for older version of WordPress

While investing this issue, I've found that phpMailer invokes sending method differently in older version. phpMailer with wordpress 4.4, invokes "{$this->Mailer}Send".

WordPress 4.4.2

switch ($this->Mailer) {
                case 'sendmail':
                case 'qmail':
                    return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
                case 'smtp':
                    return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
                case 'mail':
                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
                default:
                    $sendMethod = $this->Mailer.'Send';
                    if (method_exists($this, $sendMethod)) {
                        return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
                    }

                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
            }

WordPress 4.2.2

switch ($this->Mailer) {
                case 'sendmail':
                    return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
                case 'smtp':
                    return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
                case 'mail':
                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
                default:
                    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
            }

Specially, notice these two lines differences:
4.4x

default:
   $sendMethod = $this->Mailer.'Send';
    if (method_exists($this, $sendMethod)) {
        return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
    }

    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);

4.2x

default:
    return $this->mailSend($this->MIMEHeader, $this->MIMEBody);

We can probably simply override mailSend in addition to custom mailer which should satisfy both version.

Link tracking not being used for {{{content}}}

It was reported that link tracking is not working for content inside the {{{content}}} block. I suspect we may have to use dynamic_html and the render_dynamic_content macro. Need to investigate and test.

No WP new user emails being sent - buddypress issue

We've installed the plugin on our local dev environment, configured it using the API key on our account and we can send test in the plugin settings page.

If we try to register a new user on the site the New account email with activation link email isn't sent to the user. I get no errors on screen and it all seems like it should be working but the emails never arrive in my inbox, I've tried sending to my company account, gmail and even mailinator but nothing comes through.

  • Wordpress 4.4
  • BuddyPress 2.5.2
  • Sparkpost plugin 2.2.1
  • PHP 5.5.12

If I look in my SparkPost dashboard I see no sign of these emails being sent by the system.

We contacted your support team and was told to post here, any ideas?.

FAQ: issues to GitHub please

The current FAQ points users to support.sparkpost.com for support. This is a community project so SparkPost Support is not responsible for it. A better option would be to use GitHub issues to track in the traditional manner.

PHP 7 compatibility

Hi,

We just upgraded our server to PHP 7.0 and the email delivery is failing, we see the following in the logs

[21-Jul-2016 08:19:13 UTC] PHP Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /wordpress-4.5.3/wp-includes/class-smtp.php on line 344

We have ensured that all PHP modules that are required are installed properly. Used to work fine in PHP 5.5

Any updates?

tracking

I would like to be able to track "opens" of messages sent through this plugin when looking at the sparkpost reporting data. I see data for targeted and accepted but no engagement data at all.

I saw this help topic on the Sparkpost site: I'm Missing Click/Open Data and so I forked this repo and added some code in the file mailer.http.class.php in the get_body function:

$body = array(
    'options' => array(
        'open_tracking' => true,
        'click_tracking' => true
    ),
    'recipients' => $this->get_recipients(),
    'content' => array(
        'from' => $this->get_sender(),
        'subject' => $this->Subject,
        'headers' => $this->build_email_headers()
    )
);

[I added the options array to the $body].

When I sent a test mail through the plugin's settings page with debug checked, I could see that the json object that was POSTed correctly included that options array, but after loading images in my mail client for the test email, I saw the data for the message having been sent, but still did not see any engagement data (I do have a verified tracking domain set up).

What would it take for this plugin to be able to create email that would allow tracking opens and clicks?

SparkPost WP plugin issue for client site on reseller server

Hello, I'm a first-time user of GitHub.

I have a reseller account, running on a wildcard domain *.tykesden.be.
I have full control over this domain, and in SparkPost, it is ready to send.
However, I have a client site running on it. Technically tkds001.tykesden.be, but officially www.fikamo.be.
I have no control over that domain, and even if I did, due to constraints of that particular domain registrar, even users with access cannot add any TXT records to their domain there, which is necessary to get SparkPost running.
At SparkPost, I was given the advice to work with subaccounts in order to get started (using SMTP, with separate API keys + the necessary permissions).
Unfortunately, it is still impossible to send a test email from within the SparkPost plugin of the client site.

I would be very grateful if anyone could send me the url of a page where I can find an example of how to deal with this kind of issue, either a video recorded within a WP Dashboard or exact instructions.

I am migrating from Mandrill, this client site may be missing out on messages from potential clients ever since sending became disabled!

If extra info is necessary, please let me know, I'll gladly provide it.

Many thanks in advance,
Myriam De Clercq

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.