-
|
@@ -200,7 +210,7 @@
|
- | |
+ |
|
@@ -214,11 +224,11 @@
|
- | |
+ |
-
| |
@@ -228,7 +238,7 @@
- | |
+ |
@@ -241,7 +251,7 @@
- | |
+ |
|
@@ -251,23 +261,23 @@
- | |
+ |
- |
+ |
Note: this email message was auto-generated, please do not respond. For further
assistance, please join our Discord server or make a
+ style="text-decoration:none;color:#fff;">Discord server or make a
post on our Forum.
+ style="text-decoration:none;color:#fff;">Forum.
|
- | |
+ |
|
diff --git a/src/mailer.ts b/src/mailer.ts
index 6f46b7b..e28b4d4 100644
--- a/src/mailer.ts
+++ b/src/mailer.ts
@@ -51,7 +51,7 @@ export class CreateEmail {
private readonly componentArray: (emailComponent | paddingComponent | buttonComponent)[] = [];
/**
- * adds padding of the specified height in px
+ * adds padding of the specified height in em units
*/
private addPadding(size: number): paddingComponent {
return {
@@ -65,7 +65,7 @@ export class CreateEmail {
*/
public addHeader(text: string, replacements?: emailTextReplacements): this {
const component: emailComponent = { type: 'header', text, replacements };
- this.componentArray.push(this.addPadding(36), component, this.addPadding(24));
+ this.componentArray.push(this.addPadding(3), component, this.addPadding(2));
return this;
}
@@ -75,7 +75,7 @@ export class CreateEmail {
*/
public addParagraph(text: string, replacements?: emailTextReplacements): this {
const component: emailComponent = { type: 'paragraph', text, replacements };
- this.componentArray.push(component, this.addPadding(16));
+ this.componentArray.push(component, this.addPadding(0.5));
return this;
}
@@ -89,7 +89,7 @@ export class CreateEmail {
*/
public addButton(text: string, link?: string, primary: boolean = true): this {
const component: buttonComponent = { type: 'button', text, link, primary };
- this.componentArray.push(this.addPadding(4), component, this.addPadding(32));
+ this.componentArray.push(component, this.addPadding(2));
return this;
}
@@ -107,7 +107,7 @@ export class CreateEmail {
if (plainText) {
c.text = c.text.replace(/{{pnid}}/g, value);
} else {
- c.text = c.text.replace(/{{pnid}}/g, `${value}`);
+ c.text = c.text.replace(/{{pnid}}/g, `${value}`);
}
}
});
@@ -120,7 +120,7 @@ export class CreateEmail {
if (plainText) {
c.text = c.text.replace(linkRegex, `$ ($)`);
} else {
- c.text = c.text.replace(linkRegex, `$`);
+ c.text = c.text.replace(linkRegex, `$`);
}
}
}
@@ -130,24 +130,29 @@ export class CreateEmail {
let innerHTML = '';
this.componentArray.forEach((c) => {
- let el = '';
+ let el = ' ';
+ if (c.type !== 'padding') {
+ el = this.addGmailDarkModeFix(c.text);
+ }
switch (c.type) {
case 'padding':
- innerHTML += `\n| | `;
+ innerHTML += `\n| ${el} | `;
break;
case 'header':
this.parseReplacements(c);
- el = this.addGmailDarkModeFix(c.text);
- innerHTML += `\n `;
+ innerHTML += `\n `;
break;
case 'paragraph':
this.parseReplacements(c);
- el = this.addGmailDarkModeFix(c.text);
innerHTML += `\n| ${el} | `;
break;
case 'button':
- el = this.addGmailDarkModeFix(c.text);
- innerHTML += `\n| ${el} | `;
+ if (c.link) {
+ el = `${el}`;
+ } else {
+ el = `${el}`;
+ }
+ innerHTML += `\n| ${el} | `;
break;
}
});
|