Merge pull request #606 from sharetribe/mail-templates

Add all default mail templates
This commit is contained in:
Boyan Tabakov 2017-12-20 10:14:30 +02:00 committed by GitHub
commit cb34262b6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 711 additions and 0 deletions

View file

@ -0,0 +1,150 @@
# Mail templates
This directory contains templates for all default mails sent as result of
activity in the marketplace.
Note that, at present, changes made to the template files here will not take
effect automatically. Marketplace owner needs to notify the Sharetribe team.
## Template parts
A template consists of three files:
* `TEMPLATE_NAME-subject.txt` - holds the mail Subject line template
* `TEMPLATE_NAME-text.txt` - holds the template for the plain text version of the mail
* `TEMPLATE_NAME-html.html` - contains the template for the HTML version of the mail
All the parts are mandatory. All emails that are sent from the marketplace
contain both the plain text and HTML variants and the recipient's mail client is
free to choose which one to visualize and how.
## Template syntax
Templates use [Handlebars](http://handlebarsjs.com/) syntax.
Example html:
```html
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>Your <em>{{marketplace.name}}</em> account&#x27;s email address was changed.</p>
<p>If you didn&#x27;t make this change, please contact us.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>
```
Example text version:
```
Hello {{recipient.first-name}},
Your {{marketplace.name}} account's email address was changed.
If you didn't make this change, please contact us.
Best regards,
The {{marketplace.name}} team
```
Variables within `{{ }}` are expanded and escaped, so that they are safe to
place inside HTML content. As seen above, some variables have nested values,
which can be accessed with dot `.` operator.
The template syntax supports conditionals, loops, helpers and other constructs.
For details see the [Handlebars documentation](http://handlebarsjs.com/).
## List of templates
### Built-in event mails
#### email-changed
Sent to a user when their registered email address has been successfully
changed.
#### new-message
Sent to a user when the other party in a transaction has sent them a new
message.
#### password-changed
Sent to a user when their account's password was successfully changed.
#### reset-password
Sent to a user when a request for resetting their password is received. The mail
contains a link with password reset token and instructs the user to complete the
password reset.
#### verify-changed-email-address
Sent to a user when they have requested to change their registered email
address. The mail contains an email verification link and instructs the user how
to verify their email address.
#### verify-email-address
Sent to a user after they sign up for an account in the marketplace and
instructs them to verify their email address.
### Transaction engine mails
The templates in the list below correspond to mails defined in the default
transaction process. Customized transaction processes can have different set of
mail templates.
`customer` and `provider` below mean the corresponding parties in a transaction.
#### booking-request-accepted
Sent to the customer when the provider accepts a booking and the customer's
payment is captured.
#### booking-request-auto-declined
Sent to the customer when the provider does not accept the booking within the
allowed time and the transaction is automatically declined.
#### booking-request-declined
Sent to the customer when the provider manually declines a transaction.
#### money-paid
Sent to the provider when a booking's end date has passed and payment is sent to
the provider's bank account.
#### new-booking-request
Sent when a customer makes a new booking and preauthorizes payment.
#### review-by-customer-wanted
Sent to the customer when the booking end-date has passed and reviews for the
transaction can be posted. This mail should prompt the recipient to write a
review.
#### review-by-other-party-published
Sent to one of the parties in a transaction when the other party has posted a
review and the review has been published (i.e. contents of the review are
public).
#### review-by-other-party-unpublished
Sent to one of the parties in a transation when the other party has posted a
review but the review is not yet published, because the first party hasn't yet
posted their review or the review time has not expired. This mail should prompt
the recipient to write their own review.
#### review-by-provider-wanted
Sent to the customer when the booking end-date has passed and reviews for the
transaction can be posted. This mail should prompt the recipient to write a
review.

View file

@ -0,0 +1,47 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
<html>
<body>
<h1>Your booking request was accepted!</h1>
{{#with transaction}}
<p>{{provider.display-name}} has accepted your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}.</p>
<p>We have charged {{> format-money money=payin-total}} from your credit card. Here's your receipt.</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Payment</th>
</tr>
</thead>
<tbody>
{{#each line-items}}
{{#contains include-for "customer"}}
<tr>
{{#eq "night" code}}
<td>{{> format-money money=unit-price}} &times; {{number quantity}} {{inflect quantity "night" "nights"}}</td>
<td style="padding-left: 20px;">{{> format-money money=line-total}}</td>
{{/eq}}
</tr>
{{/contains}}
{{/each}}
</tbody>
<tfoot>
<tr>
<th style="text-align: left;">Payment total</th>
<th style="text-align: left; padding-left: 20px;">{{> format-money money=payin-total}}</th>
</tr>
</tfoot>
</table>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
{{transaction.provider.display-name}} accepted your booking request!

View file

@ -0,0 +1,27 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
Your booking request was accepted!
{{#with transaction~}}
{{provider.display-name}} has accepted your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}.
We have charged {{> format-money money=payin-total}} from your credit card. Here's your receipt.
Payment
{{#each line-items~}}
{{~#contains include-for "customer"~}}
{{~#eq "night" code~}}
{{> format-money money=unit-price}} x {{number quantity}} {{inflect quantity "night" "nights"}}: {{> format-money money=line-total}}
{{/eq~}}
{{~/contains~}}
{{/each~}}
Payment total: {{> format-money money=payin-total}}
{{~/with}}

View file

@ -0,0 +1,16 @@
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
<html>
<body>
<h1>Your booking request has expired.</h1>
{{#with transaction}}
<p>Unfortunately {{provider.display-name}} didn't respond to your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}} on time, so the request has expired. You have not been billed.</p>
{{/with}}
<p><a href="{{marketplace.url}}">Try to book something else instead</a></p>
</body>
</html>

View file

@ -0,0 +1 @@
Your booking request has expired

View file

@ -0,0 +1,12 @@
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
Your booking request has expired.
{{#with transaction~}}
Unfortunately {{provider.display-name}} didn't respond to your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}} on time, so the request has expired. You have not been billed.
{{~/with}}
Try to book something else instead: {{marketplace.url}}

View file

@ -0,0 +1,16 @@
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
<html>
<body>
<h1>Your booking request was declined.</h1>
{{#with transaction}}
<p>Unfortunately {{provider.display-name}} decided to decline your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}. You have not been billed.</p>
{{/with}}
<p><a href="{{marketplace.url}}">Try to book something else instead</a></p>
</body>
</html>

View file

@ -0,0 +1 @@
{{transaction.provider.display-name}} declined your booking request

View file

@ -0,0 +1,12 @@
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
Your booking request was declined.
{{#with transaction~}}
Unfortunately {{provider.display-name}} decided to decline your booking request for {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}. You have not been billed.
{{~/with}}
Try to book something else instead: {{marketplace.url}}

View file

@ -0,0 +1,11 @@
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>Your <em>{{marketplace.name}}</em> account&#x27;s email address was changed.</p>
<p>If you didn&#x27;t make this change, please contact us.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>

View file

@ -0,0 +1 @@
{{marketplace.name}} email address changed

View file

@ -0,0 +1,8 @@
Hello {{recipient.first-name}},
Your {{marketplace.name}} account's email address was changed.
If you didn't make this change, please contact us.
Best regards,
The {{marketplace.name}} team

View file

@ -0,0 +1,52 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
<html>
<body>
{{#with transaction}}
<h1>You have been paid {{> format-money money=payout-total}}</h1>
<p>We have sent you {{> format-money money=payout-total}} for the booking of {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}} by {{customer.display-name}}. It might take up to 7 days for the money to reach your bank account.</p>
<p>Here's the breakdown.</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Payment</th>
</tr>
</thead>
<tbody>
{{#each line-items}}
{{#contains include-for "provider"}}
<tr>
{{#eq "night" code}}
<td>{{> format-money money=unit-price}} &times; {{number quantity}} {{inflect quantity "night" "nights"}}</td>
<td style="text-align: right; padding-left: 20px">{{> format-money money=line-total}}</td>
{{/eq}}
{{#eq "provider-commission" code}}
<td>{{marketplace.name}} fee:</td>
<td style="text-align: right; padding-left: 20px;">{{> format-money money=line-total}}</td>
{{/eq}}
</tr>
{{/contains}}
{{/each}}
</tbody>
<tfoot>
<tr>
<th style="text-align: left;">You earn</th>
<th style="text-align: right; padding-left: 20px;">{{> format-money money=payout-total}}</th>
</tr>
</tfoot>
</table>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
You have been paid {{money-amount transaction.payout-total}} {{transaction.payout-total.currency}}

View file

@ -0,0 +1,29 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
{{#with transaction~}}
You have been paid {{> format-money money=payout-total}}
We have sent you {{> format-money money=payout-total}} for the booking of {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}} by {{customer.display-name}}. It might take up to 7 days for the money to reach your bank account.
Here's the breakdown.
Payment
{{#each line-items~}}
{{~#contains include-for "provider"~}}
{{~#eq "night" code~}}
{{> format-money money=unit-price}} x {{number quantity}} {{inflect quantity "night" "nights"}}: {{> format-money money=line-total}}
{{/eq~}}
{{~#eq "provider-commission" code~}}
{{marketplace.name}} fee: {{> format-money money=line-total}}
{{/eq~}}
{{~/contains~}}
{{/each~}}
You earn: {{> format-money money=payout-total}}
{{~/with}}

View file

@ -0,0 +1,54 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
<html>
<body>
{{#with transaction}}
<h1>Please respond to a request by {{customer.display-name}}</h1>
<p>Good news! {{customer.display-name}} just requested to book {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}. Here's the breakdown.</p>
<table>
<thead>
<tr>
<th style="text-align: left;">Payment</th>
</tr>
</thead>
<tbody>
{{#each line-items}}
{{#contains include-for "provider"}}
<tr>
{{#eq "night" code}}
<td>{{> format-money money=unit-price}} &times; {{number quantity}} {{inflect quantity "night" "nights"}}</td>
<td style="text-align: right; padding-left: 20px">{{> format-money money=line-total}}</td>
{{/eq}}
{{#eq "provider-commission" code}}
<td>{{marketplace.name}} fee:</td>
<td style="text-align: right; padding-left: 20px;">{{> format-money money=line-total}}</td>
{{/eq}}
</tr>
{{/contains}}
{{/each}}
</tbody>
<tfoot>
<tr>
<th style="text-align: left;">You earn</th>
<th style="text-align: left; padding-left: 20px;">{{> format-money money=payout-total}}</th>
</tr>
</tfoot>
</table>
<p>You need to accept the request by {{> format-date date=booking-expires-on}}. Otherwise the request will be expired and you won't get paid. If the booked dates won't work for you, you can also choose to decline the request.</p>
<p><a href="{{marketplace.url}}/sale/{{url-encode id}}/details">Accept or decline the booking</a></p>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
{{transaction.customer.display-name}} has requested to book {{transaction.listing.title}}

View file

@ -0,0 +1,32 @@
{{~#*inline "format-money"~}}
{{money-amount money}} {{money.currency}}
{{~/inline~}}
{{~#*inline "format-date"~}}
{{date date format="MMM d, YYYY"}}
{{~/inline~}}
{{#with transaction~}}
Please respond to a request by {{customer.display-name}}
Good news! {{customer.display-name}} just requested to book {{listing.title}} from {{> format-date date=booking.start}} to {{> format-date date=booking.end}}. Here's the breakdown.
Payment
{{#each line-items~}}
{{~#contains include-for "provider"~}}
{{~#eq "night" code~}}
{{> format-money money=unit-price}} x {{number quantity}} {{inflect quantity "night" "nights"}}: {{> format-money money=line-total}}
{{/eq~}}
{{~#eq "provider-commission" code~}}
{{marketplace.name}} fee: {{> format-money money=line-total}}
{{/eq~}}
{{~/contains~}}
{{/each~}}
You earn: {{> format-money money=payout-total}}
You need to accept the request by {{> format-date date=booking-expires-on}}. Otherwise the request will be expired and you won't get paid. If the booked dates won't work for you, you can also choose to decline the request.
Accept or decline the booking: {{marketplace.url}}/sale/{{url-encode id}}/details
{{~/with}}

View file

@ -0,0 +1,19 @@
<html>
<body>
{{#with message}}
<h1>You have a new message from {{sender.display-name}}</h1>
<blockquote>"{{content}}"</blockquote>
{{#eq recipient-role "customer"}}
<p><a href="{{marketplace.url}}/order/{{url-encode transaction.id}}/details">Reply to {{sender.display-name}}</a></p>
{{/eq}}
{{#eq recipient-role "provider"}}
<p><a href="{{marketplace.url}}/sale/{{url-encode transaction.id}}/details">Reply to {{sender.display-name}}</a></p>
{{/eq}}
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
{{message.sender.display-name}} has sent you a new message

View file

@ -0,0 +1,15 @@
{{#with message~}}
You have a new message from {{sender.display-name}}
"{{content}}"
{{#eq recipient-role "customer"~}}
Reply to {{sender.display-name}}: {{marketplace.url}}/order/{{url-encode transaction.id}}/details
{{/eq~}}
{{#eq recipient-role "provider"~}}
Reply to {{sender.display-name}}: {{marketplace.url}}/sale/{{url-encode transaction.id}}/details
{{/eq~}}
{{~/with}}

View file

@ -0,0 +1,11 @@
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>Your <em>{{marketplace.name}}</em> account&#x27;s password was changed.</p>
<p>If you didn&#x27;t make this change, please contact us.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>

View file

@ -0,0 +1 @@
{{marketplace.name}} password changed

View file

@ -0,0 +1,8 @@
Hello {{recipient.first-name}},
Your {{marketplace.name}} account's password was changed.
If you didn't make this change, please contact us.
Best regards,
The {{marketplace.name}} team

View file

@ -0,0 +1,15 @@
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>You have indicated that you have forgotten your password for <em>{{marketplace.name}}</em>. Click the following link to reset your password:</p>
<p><a href="{{marketplace.url}}/reset-password?t={{url-encode password-reset.token}}&e={{url-encode password-reset.email-address}}">{{marketplace.url}}/reset-password?t={{url-encode password-reset.token}}&e={{url-encode password-reset.email-address}}</a></p>
<p>If you don't use this link within 1 hour, it will expire. You can request a new password reset link, if you need to.</p>
<p>If you didn't request this, please ignore this email. Your password won't be changed until you use the link above to set a new one.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>

View file

@ -0,0 +1 @@
Password reset instructions for {{marketplace.name}}

View file

@ -0,0 +1,12 @@
Hello {{recipient.first-name}},
You have indicated that you have forgotten your password for {{marketplace.name}}. Click the following link to reset your password:
{{marketplace.url}}/reset-password?t={{url-encode password-reset.token}}&e={{url-encode password-reset.email-address}}
If you don't use this link within 1 hour, it will expire. You can request a new password reset link, if you need to.
If you didn't request this, please ignore this email. Your password won't be changed until you use the link above to set a new one.
Best regards,
The {{marketplace.name}} team

View file

@ -0,0 +1,11 @@
<html>
<body>
{{#with transaction}}
<h1>How was your experience with {{listing.title}}? Write a review!</h1>
<p>You recently booked {{listing.title}} from {{provider.display-name}}. Please write a review to describe your experience. Reviews are important part of the {{marketplace.name}} community.</p>
<p><a href="{{marketplace.url}}/order/{{url-encode id}}/details">Leave a review</a></p>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
Write a review for {{transaction.listing.title}}

View file

@ -0,0 +1,9 @@
{{~#with transaction~}}
How was your experience with {{listing.title}}? Write a review!
You recently booked {{listing.title}} from {{provider.display-name}}. Please write a review to describe your experience. Reviews are important part of the {{marketplace.name}} community.
Leave a review: {{marketplace.url}}/order/{{url-encode id}}/details
{{~/with~}}

View file

@ -0,0 +1,19 @@
<html>
<body>
{{#with transaction}}
<h1>{{other-party.display-name}} wrote you a review. Here's what they wrote.</h1>
{{#each reviews}}
{{#eq recipient.id subject.id}}
<blockquote><i>"{{content}}"</i></blockquote>
{{/eq}}
{{/each}}
<p>The review has been published on your {{marketplace.name}} profile.</p>
<p>
<a href="{{marketplace.url}}/u/{{url-encode recipient.id}}">View your profile.</a>
</p>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
Read the review {{other-party.display-name}} wrote you

View file

@ -0,0 +1,14 @@
{{~#with transaction~}}
{{other-party.display-name}} wrote you a review. Here's what they wrote.
{{#each reviews~}}
{{#eq recipient.id subject.id}}"{{content}}"{{/eq}}
{{~/each}}
The review has been published on your {{marketplace.name}} profile.
View your profile: {{marketplace.url}}/u/{{url-encode recipient.id}}
{{~/with~}}

View file

@ -0,0 +1,13 @@
<html>
<body>
{{#with transaction}}
<h1>Find out what {{other-party.display-name}} wrote!</h1>
<p>{{other-party.display-name}} has left you a new review. To see what they wrote, please leave them a review to describe your experience.</p>
<p>
<a href="{{marketplace.url}}/{{#eq recipient-role "customer"}}order{{else}}sale{{/eq}}/{{url-encode id}}/details">Leave a review</a>
</p>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
{{other-party.display-name}} wrote you a review

View file

@ -0,0 +1,10 @@
{{~#with transaction~}}
Find out what {{other-party.display-name}} wrote!
{{other-party.display-name}} has left you a new review. To see what they wrote, please leave them a review to describe your experience.
Leave a review: {{marketplace.url}}/{{#eq recipient-role "customer"}}order{{else}}sale{{/eq}}/{{url-encode id}}/details
{{~/with~}}

View file

@ -0,0 +1,11 @@
<html>
<body>
{{#with transaction}}
<h1>How was your experience with {{customer.display-name}}? Write a review!</h1>
<p>{{customer.display-name}} recently booked {{listing.title}} from you. Please write {{customer.display-name}} a review to describe your experience. Reviews are important part of the {{marketplace.name}} community.</p>
<p><a href="{{marketplace.url}}/sale/{{url-encode id}}/details">Leave a review</a></p>
{{/with}}
</body>
</html>

View file

@ -0,0 +1 @@
Write a review for {{transaction.customer.display-name}}

View file

@ -0,0 +1,9 @@
{{~#with transaction~}}
How was your experience with {{customer.display-name}}? Write a review!
{{customer.display-name}} recently booked {{listing.title}} from you. Please write {{customer.display-name}} a review to describe your experience. Reviews are important part of the {{marketplace.name}} community.
Leave a review: {{marketplace.url}}/sale/{{url-encode id}}/details
{{~/with~}}

View file

@ -0,0 +1,15 @@
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>To complete your email address change in <em>{{marketplace.name}}</em>, verify your email by clicking the link below:</p>
<p><a href="{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}">{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}</a></p>
<p>Alternatively, you can copy the link to your browser's address bar.</p>
<p>If you don't use this link within 2 days, it will expire. You can request a new verification link, if you need to.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>

View file

@ -0,0 +1 @@
Email verification instructions for {{marketplace.name}}

View file

@ -0,0 +1,12 @@
Hello {{recipient.first-name}},
To complete your email address change in {{marketplace.name}}, verify your email by clicking the link below:
{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}
Alternatively, you can copy the link to your browser's address bar.
If you don't use this link within 2 days, it will expire. You can request a new verification link, if you need to.
Best regards,
The {{marketplace.name}} team

View file

@ -0,0 +1,15 @@
<html>
<body>
<p>Hello {{recipient.first-name}},</p>
<p>To complete your signup to <em>{{marketplace.name}}</em>, verify your email by clicking the link below:</p>
<p><a href="{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}">{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}</a></p>
<p>Alternatively, you can copy the link to your browser's address bar.</p>
<p>If you don't use this link within 2 days, it will expire. You can request a new verification link, if you need to.</p>
<p>Best regards,<br />The {{marketplace.name}} team</p>
</body>
</html>

View file

@ -0,0 +1 @@
Email verification instructions for {{marketplace.name}}

View file

@ -0,0 +1,12 @@
Hello {{recipient.first-name}},
To complete your signup to {{marketplace.name}}, verify your email by clicking the link below:
{{marketplace.url}}/verify-email?t={{url-encode email-verification.token}}
Alternatively, you can copy the link to your browser's address bar.
If you don't use this link within 2 days, it will expire. You can request a new verification link, if you need to.
Best regards,
The {{marketplace.name}} team