Search code examples
htmlemailhtml-emailnodemailer

Format Email Raw Source to Reuse Styling


I am trying to copy the source code of a 3rd party email provider I'm using to match their look and feel.

I am viewing the raw source, to format it I had to remove all the =\ns (the end value of a line because the raw source breaks it up), however I still can't seem to figure out what to do from there to copy the styling since I can't find a parser to correctly handle this email HTML. Any recommendations on formatting an email or just grabbing the styling of it?

PS: I'm using nodemailer for sending emails


Solution

  • It was a bit of a pain, but here are the steps in visual studio code:

    1. Remove all =\n ("=" followed by new line)

    2. rename to an .html file if you haven't instead of .eml

    3. replace all instances of =3D" with ="

    4. search for any more locations for 3D, delete each one you can

    5. Now you have good html which just needs to be formatted, I recommend using a formatter like https://www.freeformatter.com/html-formatter.html

    6. You now have your template, use templated strings to insert variables as needed. Use this for the html value of nodemailer