Skip to content

Commit

Permalink
Fix: support name attribute for smtp plugin (#8412)
Browse files Browse the repository at this point in the history
* fix(nocodb): support name parameter for email plugin

* fix(nocodb): update placeholders

* fix: plugin minor correction

* fix: object overwrite other
  • Loading branch information
DarkPhoenix2704 committed May 24, 2024
1 parent c6dfa51 commit b6dae93
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
13 changes: 9 additions & 4 deletions packages/nocodb/src/plugins/smtp/SMTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand Down
23 changes: 15 additions & 8 deletions packages/nocodb/src/plugins/smtp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
Expand Down

0 comments on commit b6dae93

Please sign in to comment.