opa : sending mail

2019-08-09 00:13发布

问题:

I'm trying to send an email using SmtpClient.try_send(). This code used to work before opa switch to the node.js backend :

import stdlib.web.mail.smtp.client
import stdlib.web.mail

function start()
{
        Email.email from = {name:some("name"), address:{local:"contact", domain:"hello.com"}}
        Email.email to = {name:some("name"), address:{local:"contact", domain:"hello.com"}}
        Email.content content = {text : "This is Great!"}
        SmtpClient.try_send(from, to, "subject",content, Email.default_options)
        <>Hello</>
}

Server.start(
   {port:8092, netmask:0.0.0.0, encryption: {no_encryption}, name:"test"},
   [
     {page: start, title: "test" }
   ]
)

But now it fails with the following error :

Test serving on http://ks3098156.kimsufi.com:8092

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: write EPIPE
    at errnoException (net.js:646:11)
    at Object.afterWrite [as oncomplete] (net.js:480:18)

What's wrong ?

Thanks,

回答1:

Can you try with :

SmtpClient.try_send(from, to, "subject", content, { Email.default_options with to:[to] })



标签: email opa