If you want to send an email from your liferay portal then its bit easy because liferay provide an Utility class called MailEngine.So we don’t have to play with direct JavaMail API.
In this article, we’ll use Gmail as SMTP
MailMessage mailMessage = new MailMessage();
mailMessage.setHTMLFormat(true);
mailMessage.setBody("set body here");
mailMessage.setFrom(new InternetAddress("fromAddress","fromName"));
mailMessage.setSubject("set mail subject here");
mailMessage.setTo(new InternetAddress("set receiver email id here"));
mailEngine.send(mailMessage);
send(InternetAddress from, InternetAddress[] to, InternetAddress[] cc, InternetAddress[] bcc,
String subject, String body, boolean html format, InternetAddress[] replyTo, String messageId,
String inReplyTo, File[] attachments);
I hope this tutorial will help you.. 🙂
Get free consultation and let us know your project idea to turn
it into an amazing digital product.