我可以在不使用系统属性的情况下使用 Scala/Lift 发送电子邮件吗?
我想实现一个简单的电子邮件发送功能,因为
object SendEmail {
apply(smtpServer: String, login: String, password: String, from: String, subject: String, message: String) {
//... implementation...
}
}
我发现的所有示例都设置系统属性来初始化邮件传输,但我希望拥有这种简单、灵活和并发安全的功能。这可能吗?
I'd like to implement a simple e-mail sending function as
object SendEmail {
apply(smtpServer: String, login: String, password: String, from: String, subject: String, message: String) {
//... implementation...
}
}
All the examples I've found set system properties to initialize a mail transport, but I'd like to have that simple, flexible and concurrency-safe function. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这对您来说是否足够,但是您可以创建一个这样的会话:
props 是一个 java.util.Properties (您是指系统属性吗?)实例。
然后您可以创建消息。
I don't know if that is sufficient for you, but you can create a session like that:
props being a
java.util.Properties
(did you mean that by system properties?) instance.Then you can create a message.