Foren
How to send Email using Structure and template ?
chirag @ India, geändert vor 10 Jahren.
How to send Email using Structure and template ?
Regular Member Beiträge: 129 Beitrittsdatum: 21.12.11 Neueste Beiträge
Hi guys
I want to send email using velocity template . i try below code, but not working.
#set($MailService = $serviceLocator.findService('com.liferay.mail.service.MailService'))
#set($MailEngine = $serviceLocator.findService('com.liferay.util.mail.MailEngine'))
#set($MailBus = $serviceLocator.findService('com.liferay.portal.kernel.messaging.MessageBus'))
#set ($to = $portal.getClass().forName("javax.mail.internet.InternetAddress").newInstance("abc@gmail.com"))
#set ($from = $portal.getClass().forName("javax.mail.internet.InternetAddress").newInstance("xyz@gmail.com"))
#set($sub="test")
#set($body="testmsg")
#set ($msg = $portal.getClass().forName("com.liferay.portal.kernel.mail.MailMessage").newInstance())
$msg.setTo($to)
$msg.setFrom($from)
$msg.setSubject($sub)
$msg.setBody($body)
$MailService.sendEmail($msg)
$MailEngine.send($from, $to, $sub, $body)
&&&&Help Me&&&&&
I want to send email using velocity template . i try below code, but not working.
#set($MailService = $serviceLocator.findService('com.liferay.mail.service.MailService'))
#set($MailEngine = $serviceLocator.findService('com.liferay.util.mail.MailEngine'))
#set($MailBus = $serviceLocator.findService('com.liferay.portal.kernel.messaging.MessageBus'))
#set ($to = $portal.getClass().forName("javax.mail.internet.InternetAddress").newInstance("abc@gmail.com"))
#set ($from = $portal.getClass().forName("javax.mail.internet.InternetAddress").newInstance("xyz@gmail.com"))
#set($sub="test")
#set($body="testmsg")
#set ($msg = $portal.getClass().forName("com.liferay.portal.kernel.mail.MailMessage").newInstance())
$msg.setTo($to)
$msg.setFrom($from)
$msg.setSubject($sub)
$msg.setBody($body)
$MailService.sendEmail($msg)
$MailEngine.send($from, $to, $sub, $body)
&&&&Help Me&&&&&
Bradley Wood, geändert vor 10 Jahren.
RE: How to send Email using Structure and template ?
chirag @ India, geändert vor 10 Jahren.
RE: How to send Email using Structure and template ?
Regular Member Beiträge: 129 Beitrittsdatum: 21.12.11 Neueste Beiträge
hi Bradley,
Thank you for your valuable reply and sorry for late reply to you It's working fine again thank you Bradley.....
Thank you for your valuable reply and sorry for late reply to you It's working fine again thank you Bradley.....