简体   繁体   English

Liferay 不发送电子邮件

[英]Liferay not sending emails

I'm currently experiencing an issue with Liferay, where it is not sending emails.我目前遇到 Liferay 的问题,它无法发送电子邮件。 There is an AuthenticationFailedException in the log, but not any more specifics (eg the error message received from the remote server).日志中有一个AuthenticationFailedException ,但没有更多细节(例如从远程服务器收到的错误消息)。 I have created a script to test, but get no exceptions or errors.我创建了一个脚本来测试,但没有异常或错误。

def from = new InternetAddress("user@example.com", "user@ecample.com")
def to = new InternetAddress ("other@example.com", "other@example.com")
def mail = new MailMessage(from, to, "subject", "message", false)
MailServiceUtil.sendEmail(mail)

How can I check what the cause is and resolve the issue?如何检查原因并解决问题?

Update The email is set up to send via office 365 (smtp.office365.com) and the credentials used work when I log in using the website.更新email 设置为通过 office 365 (smtp.office365.com) 发送,当我使用该网站登录时,使用的凭据有效。 When I get the properties, they are set as:当我得到属性时,它们被设置为:

mail.smtp.session.mail.smtp.host: smtp.office365.com mail.session.smtp.port: 587 mail.session.smtp.user = user@example.com mail.session.smtp.password = password mail.smtp.session.mail.smtp.host: smtp.office365.com mail.session.smtp.port: 587 mail.session.smtp.user = user@example.com mail.session.smtp.password = password

They are set via script when the password changes as the server administration page is blank.当服务器管理页面为空白时密码更改时,它们是通过脚本设置的。

def session = MailServiceUtil.getSession()
def properties = session.getProperties()
properties.setProperty(PropsKeys.MAIL_SESSION_MAIL, "password")
MailServiceUtil.clearSession()

The credentials are fine, but exceptions can occur for other reasons.凭据很好,但由于其他原因可能会出现异常。

Thanks谢谢

I'm have tried to configure Liferay smtp settings to connect office 365 (smtp.office365.com) but it's not possibile due to TLS requirements.我曾尝试配置 Liferay smtp 设置以连接 Office 365(smtp.office365.com),但由于 TLS 要求,它不可能。 Bundled java mail engine cannot work with some modern smtp.捆绑的 java 邮件引擎无法与某些现代 smtp 一起使用。

Install a postfix locally and configure it as relay smtp to smtp.office365.com, then switch Liferay to easy localhost:25 smtp. Install a postfix locally and configure it as relay smtp to smtp.office365.com, then switch Liferay to easy localhost:25 smtp.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM