Merge pull request #1838 from daVinci2793/master

Updates to Email settings/manager to include test email
This commit is contained in:
advplyr 2023-06-12 17:16:18 -05:00 committed by GitHub
commit c6405b9013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 29 additions and 2 deletions

View File

@ -34,10 +34,14 @@
<div class="w-full md:w-1/2 px-1"> <div class="w-full md:w-1/2 px-1">
<ui-text-input-with-label ref="fromInput" v-model="newSettings.fromAddress" :disabled="savingSettings" :label="$strings.LabelEmailSettingsFromAddress" /> <ui-text-input-with-label ref="fromInput" v-model="newSettings.fromAddress" :disabled="savingSettings" :label="$strings.LabelEmailSettingsFromAddress" />
</div> </div>
<div class="w-full md:w-1/2 px-1">
<ui-text-input-with-label ref="testInput" v-model="newSettings.testAddress" :disabled="savingSettings" :label="$strings.LabelEmailSettingsTestAddress" />
</div>
</div> </div>
<div class="flex items-center justify-between pt-4"> <div class="flex items-center justify-between pt-4">
<ui-btn :loading="sendingTest" :disabled="savingSettings || !newSettings.host" type="button" @click="sendTestClick">{{ $strings.ButtonTest }}</ui-btn> <ui-btn v-if="hasUpdates" :disabled="savingSettings" type="button" @click="resetChanges">{{ $strings.ButtonReset }}</ui-btn>
<ui-btn v-else :loading="sendingTest" :disabled="savingSettings || !newSettings.host" type="button" @click="sendTestClick">{{ $strings.ButtonTest }}</ui-btn>
<ui-btn :loading="savingSettings" :disabled="!hasUpdates" type="submit">{{ $strings.ButtonSave }}</ui-btn> <ui-btn :loading="savingSettings" :disabled="!hasUpdates" type="submit">{{ $strings.ButtonSave }}</ui-btn>
</div> </div>
</form> </form>
@ -93,6 +97,7 @@ export default {
secure: true, secure: true,
user: null, user: null,
pass: null, pass: null,
testAddress: null,
fromAddress: null fromAddress: null
}, },
newEReaderDevice: { newEReaderDevice: {
@ -117,6 +122,11 @@ export default {
} }
}, },
methods: { methods: {
resetChanges() {
this.newSettings = {
...this.settings
}
},
editDeviceClick(device) { editDeviceClick(device) {
this.selectedEReaderDevice = device this.selectedEReaderDevice = device
this.showEReaderDeviceModal = true this.showEReaderDeviceModal = true
@ -196,6 +206,7 @@ export default {
secure: this.newSettings.secure, secure: this.newSettings.secure,
user: this.newSettings.user, user: this.newSettings.user,
pass: this.newSettings.pass, pass: this.newSettings.pass,
testAddress: this.newSettings.testAddress,
fromAddress: this.newSettings.fromAddress fromAddress: this.newSettings.fromAddress
} }
this.savingSettings = true this.savingSettings = true

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Eingebettetes Cover", "LabelEmbeddedCover": "Eingebettetes Cover",
"LabelEnable": "Aktivieren", "LabelEnable": "Aktivieren",
"LabelEnd": "Ende", "LabelEnd": "Ende",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Enable", "LabelEnable": "Enable",
"LabelEnd": "End", "LabelEnd": "End",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Portada Integrada", "LabelEmbeddedCover": "Portada Integrada",
"LabelEnable": "Habilitar", "LabelEnable": "Habilitar",
"LabelEnd": "Fin", "LabelEnd": "Fin",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "Expéditeur", "LabelEmailSettingsFromAddress": "Expéditeur",
"LabelEmailSettingsSecure": "Sécurisé", "LabelEmailSettingsSecure": "Sécurisé",
"LabelEmailSettingsSecureHelp": "Si coché, la connexion utilisera TLS lors de la connexion au serveur. Sinon TLS est utilisé si le serveur prend en charge l'extension STARTTLS. Dans la plupart des cas, cochez si vous vous connectez au port 465. Décochez pour le port 587 ou 25. (source: nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "Si coché, la connexion utilisera TLS lors de la connexion au serveur. Sinon TLS est utilisé si le serveur prend en charge l'extension STARTTLS. Dans la plupart des cas, cochez si vous vous connectez au port 465. Décochez pour le port 587 ou 25. (source: nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Couverture du livre intégrée", "LabelEmbeddedCover": "Couverture du livre intégrée",
"LabelEnable": "Activer", "LabelEnable": "Activer",
"LabelEnd": "Fin", "LabelEnd": "Fin",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Enable", "LabelEnable": "Enable",
"LabelEnd": "End", "LabelEnd": "End",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Enable", "LabelEnable": "Enable",
"LabelEnd": "End", "LabelEnd": "End",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Uključi", "LabelEnable": "Uključi",
"LabelEnd": "Kraj", "LabelEnd": "Kraj",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Abilita", "LabelEnable": "Abilita",
"LabelEnd": "Fine", "LabelEnd": "Fine",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Ingesloten cover", "LabelEmbeddedCover": "Ingesloten cover",
"LabelEnable": "Inschakelen", "LabelEnable": "Inschakelen",
"LabelEnd": "Einde", "LabelEnd": "Einde",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Włącz", "LabelEnable": "Włącz",
"LabelEnd": "Zakończ", "LabelEnd": "Zakończ",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "Embedded Cover", "LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Включить", "LabelEnable": "Включить",
"LabelEnd": "Конец", "LabelEnd": "Конец",

View File

@ -230,6 +230,7 @@
"LabelEmailSettingsFromAddress": "From Address", "LabelEmailSettingsFromAddress": "From Address",
"LabelEmailSettingsSecure": "Secure", "LabelEmailSettingsSecure": "Secure",
"LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)", "LabelEmailSettingsSecureHelp": "If true the connection will use TLS when connecting to server. If false then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false. (from nodemailer.com/smtp/#authentication)",
"LabelEmailSettingsTestAddress": "Test Address",
"LabelEmbeddedCover": "嵌入封面", "LabelEmbeddedCover": "嵌入封面",
"LabelEnable": "启用", "LabelEnable": "启用",
"LabelEnd": "结束", "LabelEnd": "结束",

View File

@ -26,7 +26,7 @@ class EmailManager {
transporter.sendMail({ transporter.sendMail({
from: this.db.emailSettings.fromAddress, from: this.db.emailSettings.fromAddress,
to: this.db.emailSettings.fromAddress, to: this.db.emailSettings.testAddress || this.db.emailSettings.fromAddress,
subject: 'Test email from Audiobookshelf', subject: 'Test email from Audiobookshelf',
text: 'Success!' text: 'Success!'
}).then((result) => { }).then((result) => {
@ -54,6 +54,7 @@ class EmailManager {
transporter.sendMail({ transporter.sendMail({
from: this.db.emailSettings.fromAddress, from: this.db.emailSettings.fromAddress,
to: device.email, to: device.email,
subject: "Here is your Ebook!",
html: '<div dir="auto"></div>', html: '<div dir="auto"></div>',
attachments: [ attachments: [
{ {

View File

@ -10,6 +10,7 @@ class EmailSettings {
this.secure = true this.secure = true
this.user = null this.user = null
this.pass = null this.pass = null
this.testAddress = null
this.fromAddress = null this.fromAddress = null
// Array of { name:String, email:String } // Array of { name:String, email:String }
@ -26,6 +27,7 @@ class EmailSettings {
this.secure = !!settings.secure this.secure = !!settings.secure
this.user = settings.user this.user = settings.user
this.pass = settings.pass this.pass = settings.pass
this.testAddress = settings.testAddress
this.fromAddress = settings.fromAddress this.fromAddress = settings.fromAddress
this.ereaderDevices = settings.ereaderDevices?.map(d => ({ ...d })) || [] this.ereaderDevices = settings.ereaderDevices?.map(d => ({ ...d })) || []
} }
@ -38,6 +40,7 @@ class EmailSettings {
secure: this.secure, secure: this.secure,
user: this.user, user: this.user,
pass: this.pass, pass: this.pass,
testAddress: this.testAddress,
fromAddress: this.fromAddress, fromAddress: this.fromAddress,
ereaderDevices: this.ereaderDevices.map(d => ({ ...d })) ereaderDevices: this.ereaderDevices.map(d => ({ ...d }))
} }