• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SMTP Mail Configuration

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am usign Liferay6 and I have my custom portlet which sends an email. I am using JavaMailSender to send an email. I want to configure mailSender properties like smtp host, smtp port from Liferay's mail configuration. In liferay6 you can configure the SMTP server by going to Control Panel -> Server Administration -> Mail. I want to read these properties for my custom portlet and configure mailSender in my portlet. I tried configuring as mentioned below but didn't work.


mailSender.setHost(PortalUtil.getPortalProperties().getProperty("mail.session.mail.smtp.host"));
mailSender.setPort((Integer.parseInt(PortalUtil.getPortalProperties().getProperty("mail.session.mail.smtp.port"))));
mailSender.setProtocol(PortalUtil.getPortalProperties().getProperty("mail.session.mail.transport.protocol"));

I always get default values for below mentioned property even if I change it to something else through Liferay's control panel. My question is how can I get the values of outgoing smtp host & port which is configured through Liferay's mail configuration.

mail.session.mail.smtp.host = localhost
mail.session.mail.smtp.port 25

Thanks,
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you put those values in the portal-ext.properties then you'll be able to read your updated values.
You do have a portal-ext.properties file, don't you?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic