Message Boards

Mail Service in docker not success

SHAHRUL AZHAR, modified 2 Years ago.

Mail Service in docker not success

New Member Posts: 7 Join Date: 1/6/22 Recent Posts

Hi, 

I'm using liferay 7.4

I set the mail configuration at control panel>Server Administration>mail

then, in portlet, i just call mail service provided by liferay

private void sendMailMessage(
            ActionRequest actionRequest, ActionResponse actionResponse, String mailFrom, String mailTo, String title, String body)
				throws IOException, PortletException {
				String mailSubject=title;
				String mailBody=body;
				String senderMailAddress=mailFrom;
				String receiverMailAddress=mailTo;
				try {
				            MailMessage mailMessage=new MailMessage();
				            mailMessage.setBody(mailBody);
				            mailMessage.setSubject(mailSubject);
				            mailMessage.setFrom(new InternetAddress(senderMailAddress));
				            mailMessage.setTo(new InternetAddress(receiverMailAddress));
				            MailServiceUtil.sendEmail(mailMessage);
				    // SessionMessages.add((HttpServletRequest) actionRequest.getPortletSession(),"mail-send-success");
				}
				catch (Exception e) {
				    e.printStackTrace();
				}
	}

 

In my local pc, it working fine...it can send the mail successfully.

When i deploy the portlet to my development server in ubuntu (this liferay setup using docker), it not send the mail. Eventhough, it also not even have any error message inside log. How to configure that mail inside docker?