我am trying to use an email module in exist-db. For this purpose I
正在使用本文中描述的邮件发送电子邮件功能 http://en.wikibooks.org/wiki/XQuery/Sending_E-mail但它s not working and I don
不知道为什么。exide IDE 显示以下错误:exerr:ERROR 无法发送消息 java.net.UnknownHostException: smtp.google.com [第 29 行,第 6 列]
xquery version "1.0";
declare namespace mail="http://exist-db.org/xquery/mail";
declare variable $message {
<mail>
<from>some name of recipient <someRecipient@gmail.com></from>
<to>someRecipient@gmail.com</to>
<subject>Hello world</subject>
<message>
<text>Hello world!</text>
</message>
</mail>
};
if ( mail:send-email($message, 'smtp.google.com', ()) ) then
<h1>Sent Message OK :-)</h1>
else
<h1>Could not Send Message :-(</h1>
如果有人知道如何通过exist-db发送电子邮件,我将不胜感激。提前感谢!
错误消息是因为没有域smtp.google.com
。
$ host smtp.google.com
Host smtp.google.com not found: 3(NXDOMAIN)
我建议设置本地MTA并将$server
字段留空:
$server?
SMTP 服务器。如果为空,则尝试使用本地 sendmail 程序。
本地邮件服务器还将使您能够针对SMTP服务器进行身份验证,这是大多数服务器所必需的 - 例如您可能想要使用的gmail。