用newLISP通过SMTP服务器发送邮件。直接使用标准模块smtpx.lsp, smtp.lsp不能设定端口,经过试用无用。
下面是例子代码:
#!/usr/bin/newlisp
(set 'debug-flag true)
(module "smtpx.lsp")
(set 'r (SMTP:send-mail "from@my.com"
"chenshu@letv.com"
"test"
"How are you today - john doe -"
"smtp.myserver.com"
"myuser"
"mypasswd"
587))
(unless r
(println (SMTP:get-error-text)))
(exit)
debug-flag设置为true是方便输出调试信息
SMTP:get-error-text可以打印错误消息。
其他函数参考文档:
http://www.newlisp.org/code/modules/smtpx.lsp.html