Browse Source

Fix: support name attribute for smtp plugin (#8412)

* fix(nocodb): support name parameter for email plugin

* fix(nocodb): update placeholders

* fix: plugin minor correction

* fix: object overwrite other
pull/8573/head
Anbarasu 6 months ago committed by GitHub
parent
commit
b6dae93da2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      packages/nocodb/src/plugins/smtp/SMTP.ts
  2. 23
      packages/nocodb/src/plugins/smtp/index.ts

13
packages/nocodb/src/plugins/smtp/SMTP.ts

@ -13,6 +13,7 @@ export default class SMTP implements IEmailAdapter {
public async init(): Promise<any> { public async init(): Promise<any> {
const config = { const config = {
name: this.input?.name,
host: this.input?.host, host: this.input?.host,
port: parseInt(this.input?.port, 10), port: parseInt(this.input?.port, 10),
secure: secure:
@ -23,13 +24,17 @@ export default class SMTP implements IEmailAdapter {
typeof this.input?.ignoreTLS === 'boolean' typeof this.input?.ignoreTLS === 'boolean'
? this.input?.ignoreTLS ? this.input?.ignoreTLS
: this.input?.ignoreTLS === 'true', : this.input?.ignoreTLS === 'true',
auth: {
user: this.input?.username,
pass: this.input?.password,
},
tls: { tls: {
rejectUnauthorized: this.input?.rejectUnauthorized, rejectUnauthorized: this.input?.rejectUnauthorized,
}, },
...(this.input?.username || this.input?.password
? {
auth: {
...(this.input?.username ? { user: this.input?.username } : {}),
...(this.input?.password ? { pass: this.input?.password } : {}),
},
}
: {}),
}; };
this.transporter = nodemailer.createTransport(config); this.transporter = nodemailer.createTransport(config);

23
packages/nocodb/src/plugins/smtp/index.ts

@ -7,7 +7,7 @@ import type { XcPluginConfig } from 'nc-plugin';
const config: XcPluginConfig = { const config: XcPluginConfig = {
builder: SMTPPlugin, builder: SMTPPlugin,
title: 'SMTP', title: 'SMTP',
version: '0.0.2', version: '0.0.3',
// icon: 'mdi-email-outline', // icon: 'mdi-email-outline',
description: 'SMTP email client', description: 'SMTP email client',
price: 'Free', price: 'Free',
@ -18,35 +18,42 @@ const config: XcPluginConfig = {
items: [ items: [
{ {
key: 'from', key: 'from',
label: 'From', label: 'From Address',
placeholder: 'eg: admin@run.com', placeholder: 'admin@run.com',
type: XcType.SingleLineText, type: XcType.SingleLineText,
required: true, required: true,
}, },
{ {
key: 'host', key: 'host',
label: 'Host', label: 'SMTP Server',
placeholder: 'eg: smtp.run.com', placeholder: 'smtp.run.com',
type: XcType.SingleLineText,
required: true,
},
{
key: 'name',
label: 'From Domain',
placeholder: 'your-domain.com',
type: XcType.SingleLineText, type: XcType.SingleLineText,
required: true, required: true,
}, },
{ {
key: 'port', key: 'port',
label: 'Port', label: 'SMTP Port',
placeholder: 'Port', placeholder: 'Port',
type: XcType.SingleLineText, type: XcType.SingleLineText,
required: true, required: true,
}, },
{ {
key: 'secure', key: 'secure',
label: 'Secure', label: 'Use Secure Connection',
placeholder: 'Secure', placeholder: 'Secure',
type: XcType.Checkbox, type: XcType.Checkbox,
required: false, required: false,
}, },
{ {
key: 'ignoreTLS', key: 'ignoreTLS',
label: 'Ignore TLS', label: 'Ignore TLS Errors',
placeholder: 'Ignore TLS', placeholder: 'Ignore TLS',
type: XcType.Checkbox, type: XcType.Checkbox,
required: false, required: false,

Loading…
Cancel
Save