D
Deno

help

Help using DenoMailer

Ssousadiego1111/22/2023
i'm trying to use it but i get Deno is not defined when i try to send the email, any tips? how would you approach it?
import { SMTPClient } from "https://deno.land/x/denomailer@1.6.0/mod.ts";
import { IRelatoForm } from "../../types/index.ts";


export async function send(form: IRelatoForm) {
const client = new SMTPClient({
connection: {
hostname: "smtp.gmail.com",
port: 465,
tls: true,
auth: {
username: "test.test@gmail.com",
password: "test",
},
},
});
await client.send({
from: "test.test@gmail.com",
to: "test@test.com.br",
subject: "TESTE FRESH MAIL",
content: "conteudo teste",
html: `<p>${JSON.stringify(form)}</p>`,
});

await client.close();
}
import { SMTPClient } from "https://deno.land/x/denomailer@1.6.0/mod.ts";
import { IRelatoForm } from "../../types/index.ts";


export async function send(form: IRelatoForm) {
const client = new SMTPClient({
connection: {
hostname: "smtp.gmail.com",
port: 465,
tls: true,
auth: {
username: "test.test@gmail.com",
password: "test",
},
},
});
await client.send({
from: "test.test@gmail.com",
to: "test@test.com.br",
subject: "TESTE FRESH MAIL",
content: "conteudo teste",
html: `<p>${JSON.stringify(form)}</p>`,
});

await client.close();
}
No description
No description
DAHDeno AI Helper11/22/2023
I'm sorry, but the documentation does not provide information about DenoMailer. Therefore, I can't provide a specific solution to your problem. However, I can suggest some general debugging steps: 1. Make sure you're running your script with the correct permissions. Deno is secure by default, so network access (like sending an email) is not allowed unless you explicitly allow it. You can do this by adding the --allow-net flag when you run your script. 2. Check the version of Deno you're using. Some modules may not work correctly with older versions of Deno. You can check your Deno version by running deno --version in your terminal. 3. Make sure the module you're importing is compatible with your Deno version. You can usually find this information in the module's documentation or repository. 4. If you're seeing a "Deno is not defined" error, it might be because you're trying to use Deno-specific APIs in a context where they're not available, like a web worker or a frontend script. Make sure you're running your Deno code in a Deno runtime. Remember, these are general tips and might not solve your specific problem since they are not based on the documentation's information about DenoMailer.
Eeric.uhd11/22/2023
You can’t run Deno in the browser Also, you can’t run any email service on Deno Deploy due to past users abuse that led to emails port restrictions. Use some API like Postmark, or SendGrid to send emails.
Rraunioroo11/22/2023
^ beat me to it :) i'm not familiar with preact which you seem to be using, but some of these frameworks can get one easily confused where a given code is going to be run, client server or both (SSR vs CSR). that can be particularly worrying in this case, as mail server credentials are embedded in the code
Ssousadiego1111/23/2023
Happy to say the issue is solved. I was realy trying to run at the browser, was confused with it. also i'm not using with deploy, so its gonna work, thanks!
Eeric.uhd11/23/2023
Good, mark it as solved please 👍
Ssousadiego1111/23/2023
not sure how i do it..
Eeric.uhd11/23/2023
You modify your initial post, I see that you already have a tag “Deno.*API” and add the Message tag with “Solved ✅”.
Ssousadiego1111/23/2023
alright, done!

Looking for more? Join the community!

Recommended Posts
Debug all tests in VSCodeHi everyone. I was hoping to use the equivalent of "deno test" in such a way that I can set a breakMost complete Deno Rust runtime?I’m trying to embed the Deno runtime into my Rust program. I’m looking for the most “complete” Deno Language server crashing in VSC outside of deno projectsHow to write a new project template scriptHey, I've written a small game engine to create text adventures in Deno. The resulting project is a Seamlessly include TailwindcssIs there a recommended way of achieving this at the moment? What is the cleneast way of including tatidy up `deno.lock`Hey, is there something like `go mod tidy` (https://golangbyexample.com/go-mod-tidy/) in Deno? The bSyntaxError on Web3 packageI'm trying to use this module in my project https://deno.land/x/web3@v0.11.1 and i'm using the code how to document oak apiWhat’s the best way to document an oak api. Like swagger or some kind of thatweb based cmsIs there any web based cms system like word press based on deno or fresh?Minimal code for Preact SSRWhat's the actual code to do some Preact SSR with Deno? For example something simple like a counterHow to use recent Tensorflow.JS? TF from deno.land/x/tensorflow@v0.21 appears to work, but it's oldI've only tried the TF package from deno.land/x/tensorflow@v0.21 with the readme page example. I'm hDeno Deploy isolate startup timeis this startup time normal? https://media.discordapp.net/attachments/936130919163641856/11757670644Deno KV equivalent of 'returning'hello, in sqlite there is a way to get the new value set on an upsert like so insert into cCan't use npm package: Uncaught (in promise) TypeError: Could not resolve 'preact/hooks'I get this error when trying to import the Preact version of Auto-animate in Fresh https://auto-animLeaking resources from inbound HTTP connections in testsAnyone have any ideas why I would be getting the following error. I'm using an oak server that is stPreact Hello World is not working/** @jsxImportSource https://esm.sh/preact */ import { useState } from "https://esm.sh/preact/hooks"using imports map to map no-suffix imports to suffix importsI was hoping i might be able to use an import map in my deno.json like this: ``` "imports": { "./sdocker-jupyter with deno?Anyone know any good pre-made solutions? Thanks!Importing JSON files with a different file extension fails as "Unknown module"When trying to import a json file with import attributes that doesn't end with .json Deno gives the BroadcastChannel vs EventSource vs WebSocketWhy would one uses BroadcastChannel, over EventSource, or WebSocket? Could anyone provide clear exa