Allow setting of email subject
Don't know how we missed that out in the earlier one 😅
This commit is contained in:
parent
4b388e1a1b
commit
0806bae00e
2 changed files with 33 additions and 2 deletions
|
@ -60,7 +60,7 @@ app.ws('/hit-send', (ws, request) => {
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log(`\n\n-------------------------- BEGIN EMAIL --------------------------\n`)
|
console.log(`\n\n-------------------------- BEGIN EMAIL --------------------------\n`)
|
||||||
console.log(`From: ${message.from}\nTo:${message.to}\n\n${message.text}`)
|
console.log(`From: ${message.from}\nTo:${message.to}\nSubject:${message.subject||'(no subject)'}\n\n${message.text}`)
|
||||||
console.log(`\n--------------------------- END EMAIL ---------------------------`)
|
console.log(`\n--------------------------- END EMAIL ---------------------------`)
|
||||||
} else {
|
} else {
|
||||||
console.log(`Sending email: ${message.from} -> ${message.to}`)
|
console.log(`Sending email: ${message.from} -> ${message.to}`)
|
||||||
|
@ -70,6 +70,7 @@ app.ws('/hit-send', (ws, request) => {
|
||||||
from: message.from || process.env.CHIPCHOC_DEFAULT_SENDER,
|
from: message.from || process.env.CHIPCHOC_DEFAULT_SENDER,
|
||||||
to: message.to,
|
to: message.to,
|
||||||
bcc: message.from || process.env.CHIPCHOC_DEFAULT_SENDER,
|
bcc: message.from || process.env.CHIPCHOC_DEFAULT_SENDER,
|
||||||
|
subject: message.subject,
|
||||||
text: message.text,
|
text: message.text,
|
||||||
html: message.html,
|
html: message.html,
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
let tkList = []
|
let tkList = []
|
||||||
|
|
||||||
let fromEmail = ''
|
let fromEmail = ''
|
||||||
|
let subject = ''
|
||||||
|
|
||||||
let cookiePreviewData = { text: '', email: ''}
|
let cookiePreviewData = { text: '', email: ''}
|
||||||
let cookiePreviewRow = 0
|
let cookiePreviewRow = 0
|
||||||
|
@ -237,6 +238,7 @@
|
||||||
emails.push({
|
emails.push({
|
||||||
from: fromEmail,
|
from: fromEmail,
|
||||||
to: previewData.email,
|
to: previewData.email,
|
||||||
|
subject: subject,
|
||||||
text: previewData.text,
|
text: previewData.text,
|
||||||
html: converter.makeHtml(previewData.text),
|
html: converter.makeHtml(previewData.text),
|
||||||
})
|
})
|
||||||
|
@ -307,7 +309,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="email-content">
|
<div class="email-content">
|
||||||
<p>From: <input type="text" bind:value={fromEmail}/></p>
|
<div class="header">
|
||||||
|
<div class="form-group">
|
||||||
|
From
|
||||||
|
<input type="text" placeholder="chipchoc@example.com" bind:value={fromEmail}/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
Subject
|
||||||
|
<input type="text" placeholder="Hi there" bind:value={subject}/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<textarea bind:value={emailContent}/>
|
<textarea bind:value={emailContent}/>
|
||||||
<p>
|
<p>
|
||||||
<strong>Detected fields:</strong>
|
<strong>Detected fields:</strong>
|
||||||
|
@ -342,6 +353,7 @@
|
||||||
<div class="preview-header">
|
<div class="preview-header">
|
||||||
<p>From: {fromEmail || '[NOBODY!!!]'}</p>
|
<p>From: {fromEmail || '[NOBODY!!!]'}</p>
|
||||||
<p>To: {cookiePreviewData.email || '[NOBODY!!!]'}</p>
|
<p>To: {cookiePreviewData.email || '[NOBODY!!!]'}</p>
|
||||||
|
<p>Subject: {subject || '[NO SUBJECT #notgood]'}</p>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
{@html converter.makeHtml(cookiePreviewData.text)}
|
{@html converter.makeHtml(cookiePreviewData.text)}
|
||||||
|
@ -382,6 +394,7 @@
|
||||||
<div class="preview-header">
|
<div class="preview-header">
|
||||||
<p>From: {nowSending.from || '[NOBODY!!!]'}</p>
|
<p>From: {nowSending.from || '[NOBODY!!!]'}</p>
|
||||||
<p>To: {nowSending.to || '[NOBODY!!!]'}</p>
|
<p>To: {nowSending.to || '[NOBODY!!!]'}</p>
|
||||||
|
<p>Subject: {subject || '[NO SUBJECT #notgood]'}</p>
|
||||||
<hr />
|
<hr />
|
||||||
{@html nowSending.html}
|
{@html nowSending.html}
|
||||||
</div>
|
</div>
|
||||||
|
@ -438,6 +451,23 @@
|
||||||
margin: 4em auto;
|
margin: 4em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.email-content .header {
|
||||||
|
max-width: 640px;
|
||||||
|
text-align: left;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-content .form-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.email-content .form-group input {
|
||||||
|
margin-left: 1em;
|
||||||
|
width: 100%;
|
||||||
|
border: 0
|
||||||
|
}
|
||||||
|
|
||||||
.email-content textarea {
|
.email-content textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 640px;
|
max-width: 640px;
|
||||||
|
|
Loading…
Reference in a new issue