All of the text of the email’s message should be inside the <body>..</body>
section
I’d also:
- Move the remove the
<pre ..>
and</pre>
tags - Add a
<header>
section before the body, and put the<style>
section in there - Replace the newline char (
\n
) with a break (<br>
)
Your Emailbody
variable should end up with the following structure (I’ve inserted values for the the variables you had):
<html>
<header>
<style>
table, th, td {border: 1px solid black;font-family: monospace; font-size: 12px;}
th, td {padding: 5px;text-align: left;}
</style>
</header>
<body>
Dear Wile E. Coyote,<br>
<br><br> The following order is ready to dispatch in 7 days.
<br><br>
<table>
<tbody>
<tr><th>Order Number </th> <th> Po Number</th> <th> Part Number</th> <th> Description</th> <th> Qty </th> <th> Actual Delivery Date </th> </tr>
<tr><td>1234</td><td>PO54321</td><td>ABC-123</td><td>ACME JET PACK</td><td>1</td><td>11/24/2020</td> </tr>
</tbody>
</table>
<br><br><br><br><br><br><br> Regards, <br><br> Epicor Email Notification
</body>
</html>
The leading tabs on each line aren’t necessary. I just put them in for readability.
That should give you: