Skip to content

Commit

Permalink
fix(mail): fix missing bot.username, close #116
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jun 1, 2023
1 parent 9530520 commit a6054e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion adapters/mail/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@satorijs/adapter-mail",
"description": "Mail Adapter for Satorijs",
"version": "1.0.3",
"version": "1.0.4",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down
5 changes: 3 additions & 2 deletions adapters/mail/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class MailBot extends Bot<MailBot.Config> {
smtp: SMTP

async start() {
this.username = this.config.username
this.imap = new IMAP(
this.config,
this.online.bind(this),
Expand Down Expand Up @@ -79,7 +80,7 @@ export namespace MailBot {
Schema.object({
host: Schema.string().description('IMAP 服务器地址。').required(),
tls: Schema.boolean().description('是否开启 TLS 加密。').default(true),
}),
}).description('IMAP 设置'),
Schema.union([
Schema.object({
tls: Schema.const(true),
Expand All @@ -95,7 +96,7 @@ export namespace MailBot {
Schema.object({
host: Schema.string().description('SMTP 服务器地址。').required(),
tls: Schema.boolean().description('是否开启 TLS 加密。').default(true),
}),
}).description('SMTP 设置'),
Schema.union([
Schema.object({
tls: Schema.const(true),
Expand Down
2 changes: 2 additions & 0 deletions adapters/mail/src/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { MailBot } from './bot'

export class IMAP {
imap: NodeIMAP

constructor(
public config: MailBot.Config,
public onReady: () => void,
Expand Down Expand Up @@ -92,6 +93,7 @@ export interface SendOptions {
export class SMTP {
transporter: Transporter
from: string

constructor(config: MailBot.Config) {
this.transporter = createTransport({
host: config.smtp.host,
Expand Down

0 comments on commit a6054e0

Please sign in to comment.