Using templates for personalized emails
<!-- template.html --> <h1>Hello {{first_name}}!</h1> <p>Welcome to {{company_name}}.</p> <p>Your account type is: {{account_type}}</p>
{ "company_name": "ACME Corporation", "support_email": "[email protected]", "year": "2024" }
ahasend messages send \ --from [email protected] \ --to [email protected] \ --html-template template.html \ --global-substitutions company-data.json
email,first_name,account_type,balance [email protected],John,premium,1234.56 [email protected],Jane,basic,567.89
ahasend messages send \ --from [email protected] \ --recipients users.csv \ --html-template template.html \ --global-substitutions company-data.json
<!-- welcome.html --> <!DOCTYPE html> <html> <body> <h1>Welcome {{first_name}}!</h1> <p>Thank you for joining {{company_name}}.</p> <p>Your account type: {{account_type}}</p> <p>Questions? Contact {{support_email}}</p> </body> </html>
<!-- conditional.html --> <h1>Hello {{first_name}}!</h1> {% if account_type == "premium" %} <p>Thank you for being a Premium member!</p> {% else %} <p>Consider upgrading to Premium!</p> {% endif %}
<!-- order-confirmation.html --> <h1>Order Confirmation</h1> <p>Thank you, {{customer_name}}!</p> <table> {% for item in items %} <tr> <td>{{item.name}}</td> <td>{{item.quantity}}</td> <td>${{item.price}}</td> </tr> {% endfor %} </table>
ahasend messages send \ --from [email protected] \ --to [email protected] \ --html-template template.html \ --global-substitutions test-data.json \ --sandbox
{{customer_first_name}}
{{fn}}
{{name|default("Friend")}}
Was this page helpful?