Git Product home page Git Product logo

Comments (15)

rajumsys avatar rajumsys commented on July 19, 2024

You can use {{subject}} and substitution when creating Template in the SparkPost UI. In the subject field, set {{subject}} which will be replaced with actual subject when sending from WordPress. Same for From Name.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

from wordpress-sparkpost.

rajumsys avatar rajumsys commented on July 19, 2024

@xfechx
No attachment came.

A few notes that may help

  • You'll have to specify the template id in the plugin's settings page
  • Use the Test email feature in the plugin page. If problem persists, post the debug information here.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

The template works without the substitution tags of {{subject}} and
{{from_email}} on the template UI.

How can I send you debug info?

On Tue, 19 Apr 2016, 00:08 rajumsys [email protected] wrote:

@xfechx https://github.com/xfechx
No attachment came.

A few notes that may help

  • You'll have to specify the template id in the plugin's settings page
  • Use the Test email feature in the plugin page. If problem persists,
    post the debug information here.


You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub
#33 (comment)

from wordpress-sparkpost.

rajumsys avatar rajumsys commented on July 19, 2024

When you use test email in plugins settings page, you'll see a checkbox 'Show debug messages'. Check that on and it'll show some debug messages at top of settings page.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

Hi rajumsys,

I have made a test - and the subject works with the {{subject}} tag in the
Template UI, I also added {{from_email}} tag in the UI, however when doing
the test from sparkpost wp, i received an email with the format
{{from_email}}@xyz.com , which means that the from is not being
substituted... I think your plugin has issues substituting the headers
data, as I have seen quite some problems that people are having with
gravityforms, and with contact form 7.

On Tue, Apr 19, 2016 at 12:39 AM rajumsys [email protected] wrote:

When you use test email in plugins settings page, you'll see a checkbox
'Show debug messages'. Check that on and it'll show some debug messages at
top of settings page.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33 (comment)

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

I can confirm that {{from_email}} DOES NOT WORK, it doesn't get replaced as it should.

MANY wordpress plugins (including the extra popular gravityforms and contact form7) replace values from email headers depending on the actions; for instance, my sites can send email depending on the subject or actions, for example:

[email protected]
[email protected]
[email protected]

I am not sure if it's a sparkpost or the wordpress plugin issue, but it "forces" the from name, which is quite useless - it should have the flexibility to allow for other plugins to replace this data accordingly, not all emails coming from one site will be from the same "from email" name.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

It also has another critical issue when using templates:

This plugin also overrides any "reply-to", for instance with wpmandrill any email sent from gravityforms, which indicated a reply-to address, was properly sent with those headers.

This plugin forces the reply to be sent to the "from email", which is also quite useless, there are many emails in many organisations that are not actual inboxes, nor forwarders, so a reply-to is crucial.

from wordpress-sparkpost.

thehungrycoder avatar thehungrycoder commented on July 19, 2024

I can confirm that {{from_email}} DOES NOT WORK, it doesn't get replaced as it should.

AFAIK, you can't substitute from email.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

So how can we have dynamically generated notifications like mandrill or
mailgun do?

I need my sites to fire up different from different addresses like
[email protected], [email protected], etc.

Its a very basic functionality of transactional emailing....

On Wed, 20 Apr 2016, 00:20 thehungrycoder [email protected] wrote:

I can confirm that {{from_email}} DOES NOT WORK, it doesn't get replaced
as it should.

AFAIK, you can't substitute from email.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33 (comment)

from wordpress-sparkpost.

rajumsys avatar rajumsys commented on July 19, 2024

@xfechx Technically, you should be able to substitute local part of the From Email. Like {{from_email}}@domain.com (make sure there is no space in substitution tag). However, we haven't test it yet with wordpress plugin.

https://www.dropbox.com/s/6vmktj5u3y6gi83/Screenshot%202016-04-19%2010.37.59.png?dl=0

As of now, you can't substitute domain name.

I'm not totally sure, how from email substitution will work in wordpress. another alternative is

  • adding a filter for template selection (i mean currently you enter the template name in settings page; but if we add a filter, you can programmatically change what value we're passing to api)
  • you create separate templates for different types of mails, and change the template name using the filter.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

I am getting this error:

Preparing request data
Request headers: Array( [User-Agent] => wordpress-sparkpost [Content-Type]
=> application/json [Authorization] =>
fd2e************************************)
Request body: {"recipients":[{"address":{"email":"[email protected]
","name":""}}],"content":{"from":{"email":"[email protected]","name":"WordPress"},"subject":"SparkPost
email test","headers":{"Date":"Wed, 20 Apr 2016 07:24:48
+0000","Message-ID":"[email protected]","X-Mailer":"PHPMailer
5.2.14 (https://github.com/PHPMailer/PHPMailer)"},"template_id":"website-template"},"options":{"open_tracking":true,"click_tracking":true},"substitution_data":{"content":"

Hurray!!</h3>

You've
got mail! <br/>
Regards,<br/><a
href="https://www.sparkpost.com">SparkPost</a>
WordPress plugin</p>","subject":"SparkPost email
test","from_name":"WordPress"}}
Making HTTP POST request to https://api.sparkpost.com/api/v1/transmissions
Response received
Response headers: Array( [cache-control] => no-cache, no-store
[content-type] => application/json [date] => Wed, 20 Apr 2016 07:24:49 GMT
[server] => msys-http [vary] => Accept [content-length] => 241 [connection]
=> Close)
Response body: { "errors": [ { "message": "Message generation rejected",
"description": "No Sending Domain found in From header", "code": "1902" }
], "results": { "total_rejected_recipients": 0,
"total_accepted_recipients": 1, "id": "30270959232090468" } }

On Wed, Apr 20, 2016 at 12:38 AM rajumsys [email protected] wrote:

@xfechx https://github.com/xfechx Technically, you should be able to
substitute local part of the From Email. Like {{from_email}}@domain.com
(make sure there is space in substitution tag). However, we haven't test it
yet with wordpress plugin.

https://www.dropbox.com/s/6vmktj5u3y6gi83/Screenshot%202016-04-19%2010.37.59.png?dl=0


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#33 (comment)

from wordpress-sparkpost.

richleland avatar richleland commented on July 19, 2024

Did some digging here - a couple of notes:

You can indeed use a variable for from when creating a template, you just need to create the template via API - our UI doesn't support a sub data for the entire from field it only supports using substitution for the localpart.

Reply to is also able to be a variable, but again our UI does not support it.

Here's an example payload with html, from, subject, and reply_to set to variables.

{
  "id" : "wordpress-testing",
  "name" : "wp-sparkpost testing",
  "published" : true,
  "options": {
    "open_tracking" : true,
    "click_tracking" : true
  },
  "content": {
    "html": " {{{content}}}",
    "subject": "{{subject}}",
    "from": "{{from}}",
    "reply_to": "{{reply_to}}"
  }
}

I'm going to go ahead and make some tweaks to make all this work if the template is created via API. We'll also need a support article we can link to from the WordPress settings UI.

I was able to modify the code as well to make all of the above work. I'll be submitting as a PR once I clean the code up a little bit.

from wordpress-sparkpost.

richleland avatar richleland commented on July 19, 2024

This update has been published with 2.3.0 - make sure to read through https://support.sparkpost.com/customer/portal/articles/2409547-using-templates-with-the-sparkpost-wordpress-plugin for implementation details.

from wordpress-sparkpost.

xfechx avatar xfechx commented on July 19, 2024

Greetings,

Has this feature for adding all specific email headers available through the web UI, rather than only the API?

A lot of users that have come through mandrill are using the template UI for importing their mandrill themes, and I assume a lot of people do not want to mess up with the API directly.

Kind regards,

from wordpress-sparkpost.

Related Issues (20)

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.