Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Santhosh konda
Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 12:50 AM
Answer

Santhosh konda

Rank: New Member

Posts: 14

Join Date: September 16, 2011

Recent Posts

Hi,

Can you please let us know what are steps required for sending Email from a custom build Portlet in Liferay.

Can you please share the source code with all configuration path and files.
David H Nebinger
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 5:36 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11046

Join Date: September 1, 2006

Recent Posts

Sure. Can you please indicate how you're going to pay for my work?

Seriously, there is nothing magical about sending email in Liferay. You can either just use javamail directly, or you can use the com.liferay.mail.service.MailServiceUtil.sendEmail() method that hides some of the lower-level details.
Sandip Patel
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 5:46 AM
Answer

Sandip Patel

Rank: Regular Member

Posts: 188

Join Date: January 4, 2011

Recent Posts

Hi,

Along with David H Nebinger's reply you have to set some properties in portal-ext.properties.

mail.session.mail.pop3.host=localhost
mail.session.mail.pop3.password=
mail.session.mail.pop3.port=110
mail.session.mail.pop3.user=
mail.session.mail.smtp.auth=false
mail.session.mail.smtp.host=localhost
mail.session.mail.smtp.password=
mail.session.mail.smtp.port=25
mail.session.mail.smtp.user=
mail.session.mail.store.protocol=pop3
mail.session.mail.transport.protocol=smtp
Santhosh konda
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 5:49 AM
Answer

Santhosh konda

Rank: New Member

Posts: 14

Join Date: September 16, 2011

Recent Posts

Hi Sandeep;

Can you please share all the steps and source.
Santhosh konda
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 5:52 AM
Answer

Santhosh konda

Rank: New Member

Posts: 14

Join Date: September 16, 2011

Recent Posts

Hi Sandeep,

Can you please the all the steps and configuration things and source code.
Hitoshi Ozawa
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 5:53 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Following page is a little bit old but provides sufficient information to sending email from a portlet.
http://portaldevelopment.wordpress.com/2008/06/16/sending-email-in-liferay-portal/
Hitesh Methani
RE: Steps for sending Email from a custom build Portlet in Liferay
May 24, 2012 6:02 AM
Answer

Hitesh Methani

Rank: Regular Member

Posts: 171

Join Date: June 24, 2010

Recent Posts

You can use com.liferay.mail.service.MailServiceUtil.sendEmail(com.liferay.portal.kernel.mail.MailMessage message) to send the mail.

And for configuring smtp, you can use following sample smtp settings for configuring in portal-ext.properties with valid email id and password.

mail.session.mail.store.protocol=imap
mail.session.mail.transport.protocol=smtp
#smtp properties
mail.session.mail.smtp.host=smtp.gmail.com
mail.session.mail.smtp.password=validpassword
mail.session.mail.smtp.user=validid@gmail.com

mail.session.mail.smtp.port=465
mail.session.mail.smtp.auth=true
mail.session.mail.smtp.starttls.enable=true
mail.session.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory

#mail.session.mail.smtp.socketFactory.fallback=false
#mail.session.mail.smtp.socketFactory.port=465
# Other protocols mail.session.mail.imap.host=localhost
mail.session.mail.pop3.host=localhost

Thanks and Regards,
Hitesh Methani.
Mittal Patoliya
RE: Steps for sending Email from a custom build Portlet in Liferay
December 17, 2012 5:23 AM
Answer

Mittal Patoliya

Rank: New Member

Posts: 24

Join Date: December 14, 2011

Recent Posts

Can any body suggest how to do it in 6.0.6 version as I have tried from control panel as well as with property file.

portal.properties
mail.session.mail.smtps.auth=true
mail.session.mail.smtps.host=smtp.gmail.com
mail­.session.mail.smtps.password=testpass
mail.session.mail.smtps.port=465
mail.session.mail.s­mtps.user=user@gmail.com
mail.session.mail.transport.protocol=smtps
karthik reddy
RE: Steps for sending Email from a custom build Portlet in Liferay
November 8, 2013 8:38 PM
Answer

karthik reddy

Rank: Junior Member

Posts: 50

Join Date: April 8, 2013

Recent Posts

http://javaeasyforu.blogspot.in/2013/11/sending-mail-in-liferay.html
venka reddy
RE: Steps for sending Email from a custom build Portlet in Liferay
November 9, 2013 10:27 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Hi,

follow the below link , which is useful to sent mail in custom portlet.

http://liferaytutorial.blogspot.in/2013/08/sending-mail-in-liferay.html
Fernando Almeida
RE: Steps for sending Email from a custom build Portlet in Liferay
May 6, 2015 5:55 AM
Answer

Fernando Almeida

Rank: New Member

Posts: 6

Join Date: October 16, 2014

Recent Posts

To send email with attachment i use this:

MailMessage mailMessage = new MailMessage();
mailMessage.setHTMLFormat(true);
mailMessage.setSubject(assuntoEmail);
mailMessage.setBody(mensagem.toString());
try {
mailMessage.setFrom(new InternetAddress(emailFrom,"Portal Unimed"));
mailMessage.setTo(new InternetAddress("fernando.almeida@portalunimed.com.br"));
MailEngine.send(mailMessage);
} catch (AddressException | MailEngineException | UnsupportedEncodingException e1) {
e1.printStackTrace();
}