Can not connect to smtp server deno

Viewed 187

i'm quite new to deno and i was trying to send mails with it, using module smtp-client.

import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";

const client = new SmtpClient();

await client.connect({ // this is the line where error is thrown
  host: "smtp.google.com",
  port: 465,
  username: "<MY EMAIL>",
  password: "<MY EMAIL PASSWORD>",
});
// etc...

But it gives me an error, before even trying to make request (sendMail).

[0] error: Uncaught InvalidData: data did not match any variant of untagged enum ArgsEnum
[0]     at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
[0]     at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
[0]     at async Object.connect ($deno$/net.ts:180:11)
[0]     at async SmtpClient.connect (https://deno.land/x/smtp/smtp.ts:28:18)
[0]     at async file:///C:/path/to/server/controller.js:5:1
1 Answers

smtp server for gamil (AFAIK) is smtp.gmail.com

Then you have to activiate on gmail "Less Secure Applications" to allow smtp client to connect

Related