opa:发送邮件 [英] opa : sending mail

查看:208
本文介绍了opa:发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用SmtpClient.try_send()发送电子邮件。此代码用于在opa切换到node.js后端之前工作:

  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:这很棒!
SmtpClient.try_send(from,to,subject,content,Email.default_options)
&您的<<  ; />
}

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

但现在它失败并出现以下错误:

 在http://ks3098156.kimsufi.com上测试投放: 8092 

node.js:201
throw e; // process.nextTick错误,或第一次勾选错误事件
^
错误:在Object上写入EPIPE
在errnoException(net.js:646:11)
。 afterWrite [as oncomplete](net.js:480:18)

怎么了?



谢谢,

解决方案

>

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


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,

解决方案

Can you try with :

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

这篇关于opa:发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆