Message Boards

Mail service not success inside docker

SHAHRUL AZHAR, modified 2 Years ago.

Mail service not success inside docker

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

Hello, I'm using liferay 7.4

 

I configure mail property through control panel > system administration > mail

In my local pc in window,  i successfully receive mail. But when I put my portlet to server ubuntu (install liferay using docker), I not successfully receive the mail. Eventhouh error message also not produce inside log

My code in portlet is in below

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();
				}
	}

What should I do now so that I can receive mail service successfully. Thanks

thumbnail
Olaf Kock, modified 2 Years ago.

RE: Mail service not success inside docker

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

What's in the logs? Mail is configured on server level - e.g. the account used to send. Both sender as well as the credentials with some email provider. If you have configured this on your local machine, but not on another server, it won't work where it's unconfigured.