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> {
const config = {
name: this.input?.name,
host: this.input?.host,
port: parseInt(this.input?.port, 10),
secure:
@ -23,13 +24,17 @@ export default class SMTP implements IEmailAdapter {
typeof this.input?.ignoreTLS === 'boolean'
? this.input?.ignoreTLS
: this.input?.ignoreTLS === 'true',
auth: {
user: this.input?.username,
pass: this.input?.password,
},
tls: {
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);

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

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

Loading…
Cancel
Save