2012-09-03 101 views
1

我正在尝试使用SmtpClient.try_send()发送电子邮件。使用OPA开关工作前先Node.js的后端此代码:opa:发送邮件

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" } 
    ] 
) 

但现在失败,出现以下错误:

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) 

有什么不对?

感谢,

+0

哪个节点的版本,您使用的?您可以将标记node.js添加到消息中吗? – Fred

回答

1

你能尝试:

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

+0

它以相同的错误失败! – user984846

+0

您可以测试sendmail命令是否正常工作吗? – Fred

+0

就是这样! sendmail没有安装在我的系统上。谢谢 ! – user984846