Home » Liferay Portal » English » 2. Using Liferay » General

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
Jay Trivedi
Adding custom email templates
3 dicembre 2012 22.00

Jay Trivedi

Punteggio: Regular Member

Messaggi: 107

Data di Iscrizione: 23 novembre 2012

Messaggi recenti

Hey I want to create my own template for email and every time when a mail goes out its body gets attached to that template and then my template mail is sended over. I am really very confused about what to do. i.e Should i create a hook, create my custom mail vm template and than i should call that template in my portlet project? If yes! then how?
Should i create an vm file in my same portlet project then how?
please any one give me a example to come over this little problem.

I tried to create a vm file and stored in html/<namespace>/templates/mytemplate.vm, Is it correct ?
after creating it i was not able to call it to my action class.

try {
String from = "";
String to = "";
String subject = "mail-subject";
String body = "this mail is send via action class of liferay";

InternetAddress Ifrom = new InternetAddress(from, "Jay");
InternetAddress Ito = new InternetAddress(to,"Jay Trivedi");

//I want to add my body part to e-mail template, where should i save my vm or tmpl file and how to call it here in action class. in liferay6.1

MailMessage message = new MailMessage(Ifrom,Ito, subject, body,true);
System.out.println("Mail is ready to be sended!!");
System.out.println("Mail Sended successfully!!");
}catch(Exception e) {

Thanks Jay.