Format date in SendGrid template portal - handlebars.js

I'm using SendGrid portal to manage my email templates using handlebar substitutions as its reference in this link https://sendgrid.com/docs/ui/sending-email/using-handlebars/#substitution
I would like to know if it is possible to convert and/or format dates in the SendGrid transactional template portal.
This is my HTML template in SendGrid portal:
<p>This report was generated on {{GenerationTimeUtc}}</p>
This is the dynamic data sent to SendGrid:
{
"GenerationTimeUtc":"2018-09-14T21:16:30.1467851Z"
}
I would like to show it in a more readable way like "This report was generated on May 04" instead of showing "This report was generated on 2018-09-14T21:16:30.1467851Z"
I'm using SendGrid V3
Thanks in advance.

You can make use of formatDate for this type of formatting, referencing standard dateTime format flags.
<p>Join us {{formatDate dateString "M d"}}</p>
And similar implementation using a different date format…
<p>Join us {{formatDate dateString "yyyy-mm-dd"}}</p>

Related

Replace Mail Merge with syncfusion on html string data

I 'm tried to replace mail merge on word template with my data using syncfusion library. Is it possible to using html format (it is a bold text) and text format applied on my document based on mail merge key?
I am expect the format of html string applied on my document template
Yes, it is possible to perform Mail merge with the formatted HTML string which can be achieved with the help of MergeField event and InsertXHTML API. Please find the example project from below and let us know if it helps.
http://www.syncfusion.com/downloads/support/directtrac/general/ze/DocIO_CoreApp1705852960
To know more about mail merge and its events, kindly refer the following documentation link
https://help.syncfusion.com/file-formats/docio/working-with-mailmerge#event-support-for-mail-merge
Note: I work for Syncfusion
Regards,
Dilli babu.

Extract the contact form 7 data and send as an attachment through cron job

I have multiple contact forms and I am using contact form 7 and I am using Advanced CF7 to extract the CSV reports.
I want to write the cron job using WP-Cron or any other plugin to extract the CSV reports weekly and email the sheets to given email address. How can I achieve this?
I would achieve this by mapping my form submission to a custom post using Post My CF7 Form plugin. This allows you to use WordPress core functions to retrieve your post and field data.
I would then use the answer to the following question to build the CSV file programmatically. Note that in the linked answer, the code is setting up 'Content-Disposition' of the header output stream so as to trigger the file save event on the browser, however you need yours to be attached to your mail, which can be done by appending it as part of the email body. Check this tutorial to see how to do that.

Bigcommerce how to get query string from url to store into global variable

My task is the following, I need a way to store a query string value of s and pass it to the merchants Order Confirmation email.
consider the following,...mybigcommerce.com?s=fb.
Let's say that my client posts his website link to facebook and adds in a query string of s with a value of FB (facebook).
The desired result would be that on the initial load of the page, the query string would be saved as a cookie(or in Bigcommerce's case a global or store front variable)
Once I have it saved, I now know that you just simply append the variable to the email template.
example output:
email template source : %name_of_variable%.
My problem is, however, I don't see how to store the value into a variable.
Can I accomplish this without using the API, or for that matter can I do this using the API?
Thank you in advanced, I hope I have provided enough information.
Unfortunately, you cannot create your own variable in the email templates. The variables used here have been created and are supported by code within the core application. As such, it would require a core application change to extend existing functionality/add a variable. There isn't a way for you to write to an existing variable either.

Mandrill Templates With Handlebars - How To Format Date

Mandrill has a great feature that allows one to use Handlebars in templates to customize email content. See docs here.
One of the helpers that Madnrill supports is date that can be used like {{#date}}. The default date format is d/m/Y. My question is how can I specify a different date format (e.g. yyyy)?
I need to display something like 2015 Name. I tried:
{{#date yyyy}} Name - displays 05/31/15 (default format and seems to erase any HTML after it).
{{#date 'yyyy'}} Name - displays {{#date 'yyyy'}} Name (can't be parsed).
{{#date yyyy}}{{/date}} Name - displays 05/31/15 Name (default format).
{{#date 'yyyy'}}{{/date}} Name - displays {{#date 'yyyy'}}{{/date}} Name (can't be parsed).
Appreciate you help ;)
The issue was 2-fold:
You should use {{date}} instead of {{#date}}
You should use double quotes for formatting
The correct syntax would be {{date "Y"}}.
Mandrill also updated their docs that now provide more details on handlebars syntax.
I would assume this may follow the original Merge Tag formatting. Have you tried this?
http://kb.mailchimp.com/merge-tags/all-the-merge-tags-cheatsheet
Use |DATE:FORMAT| to show the current date in a given format. For example, |DATE:d/m/y| where d is replaced by the day, m by the month, and y by the year. View a full reference of date options on the PHP website. This format isn't available for automation workflows.

Drupal: How to format email message using node invite module?

I am using the node invite and token module.
I have followed this flash tutorial video: http://www.adevbox.com/files/2008-06-25_1703.swf
My problem is regarding the email format being sent.
In the ?q=admin/settings/node_invite
I have checked the blog entry checkbox. Now the node invite works but I can't format my body section value correctly.
For example:
I entered in the textarea
Hi <bold>
Then the result when I open the email message is still the same:
Hi <bold>
Same with if I use <b>bold here</b> then it will also be the format when I open the email message.
How can I format it correctly? Am I missing something simple? I am thinking of using htmlspecialchars but I don't where to put it.
Thanks in advance :)
Kind Regards,
Mark
My understanding of the Invite module is that there is no Input Filter for the template. This means that the only format that is accepted is plain text. This means that it will convert HTML into the escaped code you see.
You can validate this looking at the variables in the database. Your best bet it so path Invite (or ask for a features) to allow HTML as a valid format.

Resources