SendGrid Dynamic Templates - get recipient email in handlebars - handlebars.js

In my SendGrid dynamic template, I need to get the recipient email and pass it in the URL. Is there any way I can the recipient email from some sort of global/default variables, or I will need to pass it with the payload?

You need to pass all the data that you want to use within the body of an email template in the dynamic template data.

Related

wordpress login - insert email from GET?

i have a pretty difficult question here:
Is it possible to PRE - insert the email address in the corresponding email input from a GET request into the default wordpress form?
Here is a detailed reference how to customize the WordPress login form https://codex.wordpress.org/Customizing_the_Login_Form
Basically you can customize almost every aspect of the login form in terms of HTML.
If you want a quick solution without modifying code, you can register an additional Javascript that can read the URL query parameters from window.location.href and append it as email/username field placeholder/value attribute.
Here is a topic how to read URL GET parameters with Javascript How can I get query string values in JavaScript?

wordpress register form to salesforce

I'm wondering if it's possible to use a saleforce form for registering users on wordpress so that when a user registers on the frontend their details are sent to saleforce CRM?
The answer would vary depending on what form tool, if any, you're using, but lately I've been using Gravity Forms and have had great success with connecting to Salesforce via a custom Gravity forms redirect confirmation.
Once you have a form built in Gravity Forms, go to Form Settings > Confirmations. Edit the default Confirmation and change to Type "Redirect". You'll want to post the form to Salesforce's Web-To-Lead API, so enter https://www.salesforce.com/servlet/servlet.WebToLead in the Redirect URL field.
You'll then pass the fields you need via a query string, so check the 'Pass Field Data Via Query String' box, then configure the query string with Salesforce field names and Gravity forms merge tags. There are a couple required parameters including the encoding, your Salesforce Company ID, and a return URL to redirect back to after the form is submitted.
Leave off the ? to begin the query string, so it looks like
encoding=UTF-8&oid=0123456789&retURL=http://example.com
then add fields such as first name, last name, company, country, etc. by adding a parameter for each and selecting the appropriate Gravity Form merge tag from the menu on the right. It will end up looking something like
&first_name={First Name:1}&last_name={Last Name:2}&company={Company:3}
You can also send data to custom fields in Salesforce if you find the field ID. The easiest way to do this is by creating a Web-to-lead form in Salesforce and copying the field's name.
All together, your confirmation should look something like this -
For bonus points, you could add a hidden field to the form for the Return URL and populate it dynamically on the page, either by pulling the current page URL, or adding a custom field to choose a Return URL dynamically.
If you're not using Gravity Forms, you can still use Salesforce's Web-To-Lead tool by creating your own form, or using theirs, and sending the data in a query string.
There are various plugins that allow you to send data to Salesforce from a form, such as WordPress-to-lead for Salesforce CRM.
It is also possible to use the Salesforce API to build a single signon, and register users to or from either service. I built one for SugarCRM, which you can view the code for it at Github to get an idea of how it might work with Salesforce.

Save custom post fields value before Woocommerce email send

I have an issue regarding emails sent by Woocommerce.
I have multiple custom fields, set up using the ACF plugin, for Wooocomerce orders. These fields contain additional info that should be visible in the emails sent to the user.
But for some reason I can't get them to save before the email is send and thus the email is empty of those values. Only after I click resend email are the values visible.
I tried prioritizing the action hooks using the Prioritize Hooks plugin but to no avail. Tried multiple things in order to prioritize.
I have the Woocommerce emails set up in the template that I use and get retrieve the custom fields like this:
$fields = get_field('fields', $customer_order->ID);
How can I get this to work properly? Any help is appreciated.
you need to store your data before send the email, so you need to find the correct hook.
If i'm not wrong the before_woocommerce_pay hook is your answer check here for more woocommerce hooks

Wordpress - update functions.php from dashboard

I'm sure this isn't possible but I thought I would ask.
In my functions.php file I have a wp_mail function that sends an email to moderators when posts are made.
This email is sent to number of different address - these addresses might change.
I thought it would easier to set these email addresses in the WP Dashboard something like on custom page and then have functions.php update with the new emails.
Is this possible?
Yes, this is possible.
With out getting into the specific coding details you would need to store the different email addresses in the database.
You could tie in advanced custom fields to the wp_mail function to pull the different address from a list. That way you could skip building a page in the dashboard to display the addresses.
Regardless some custom coding would need to happen in the mail function to grab the data from advanced custom fields.

send email to email field in specific content type content creation

I'm using Drupal 7. I can't find out how to send mail to email field in specific content type content created. like, someone create content and fill out email field in that content, then site should send email notification to that email field. Is it possible? I've research Rules but with Rules basic function can't do this.
I am sure this can be done using rule, you just need to use the replacement pattern there in rules action, all the fields value are available there like [node:title] for title of the node and [node:body] for the body of the node, similarly something must be avaiable for your email field, you just need to put that replacement string in the "To value" in rules action.
Hope it helps.
if i am right, you want to send an email if new content was created?
I don't have experience with "Rules" but you could build your own custom module for that.
You only need to hook into all events you might need for that.
For example:
hook_insert: Respond to creation of a new node
This requires basic understanding of Drupal Module System.
Complete List of Hooks: http://api.drupal.org/api/drupal/includes!module.inc/group/hooks/7
Module developer's guide: http://drupal.org/developing/modules
Greetings.

Resources