I am using sendgrid api with nodejs and for some reason the emails are sending but not adding new lines. I've used and also \n but no luck. Any idea what is wrong?
Here is the code I am using
var email = {
to: '[email protected]',
from: '[email protected]',
subject: 'Membership',
text: 'Please view in html',
html: 'Hello there!,</br>\n\n' +
'Please click on the following link, or paste this into your browser to complete the process:\n\n' +
'Welcome and thanks for joining.\n\n' +
'</br>Your details we have are\n\n' +
'</br> Name: ' + user + '\n\n' + '</br> Telephone number: ' + number + '</br> email: ' + email + '</br>'
};
SendGrid supports the capability to send the single email to one or more recipients in the TO field plus one or more recipients in the CC or BCC fields (reference here: https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/personalizations.html).
SendGrid is a cloud-based SMTP provider that allows you to send email without having to maintain email servers. SendGrid manages all of the technical details, from scaling the infrastructure to ISP outreach and reputation monitoring to whitelist services and real time analytics.
Email template with HTML codeClick “Download Template,” and we'll send you a copy of the HTML code to your inbox. You can then copy/paste the code into your email design editor to import the template and tailor it to your brand and campaign.
We retain email message activity/metadata (such as opens and clicks) for 30 days. We store customer's aggregated sending stats and suppression lists (bounces, unsubscribes) and spam reports (which may contain content) indefinitely, and we store minimal random content samples for 61 days.
I assume your "Plain Content" setting is turn off in sendgrid account. To allow html tags to work you need to use triple curly braces
{{{TEMPLATE_VARIABLE}}}
It will parse html tag as html rather than plain text. If you'll use double curly braces
{{TEMPLATE_VARIABLE}}
it will consider any html tag as plain text only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With