I want to send an email by program. In the email's body text I want to include a HTML table. I set the attribute border
of the table to be 1 but it is not very good to see : the borders are thick :
var sender = "[email protected]";
let transporter = nodemailer.createTransport({
host: "some_ip_address",
port: 25,
secure: false,
tls: {
rejectUnauthorized: false
}
});
transporter.sendMail({
from: sender,
to: "[email protected]",
subject: 'test table html in email',
html: "Hello,<br/><table border='1'><thead><tr><th>entete 1</th><th>entete 2</th><th>entete 3</th></tr></thead><tbody><tr><td>data 1</td><td>data 2</td><td>data 3</td></tr></tbody></table>"
}, function (error, info) {
if (error) {
console.log('============================== Email not sent: ', error);
} else {
console.log('============================== Email sent: ', info.response);
}
});
Is it possible to set a css border to the td elements of the table so that they are like a line of 1 weight ?
You can add a style
attribute to achieve the border look you want via CSS rules.
For example:
<table border="1" style='border-collapse:collapse;'>
This should make all the borders appear thin.