Forums Register Login

Emailing form data in a portlet

+Pie Number of slices to send: Send
Hi all

I just started to work with porlets at my new project and need some help. I need to email some form data to an admin that the user enters. I have the form ok. I am assuming that when the user hits the send button on the form it will go to the processAction() method of the portlet. How do I send the form data to the admin from there?

Thanks,

AMD
+Pie Number of slices to send: Send
In your processAction(ActionRequest ...), using apache commons e-mail...

// Get my form information (for each of your items)
String firstName = request.getParameter("firstn");

if (null != firstName) firstName = request.getParameter("firstn");

StringBuilder info = new StringBuilder(1);
info.append("FIRST NAME: ").append(firstName); //etc...

SimpleEmail email = new SimpleEmail();
email.setHostName("mail.myserver.com");
email.addTo("jdoe@somewhere.org", "John Doe");
email.setFrom("me@apache.org", "Me");
email.setSubject("Test message");
email.setMsg(info.toString());
email.send();

hth
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1105 times.
Similar Threads
Portlet form data persistence
mail upon registration
Excel Export Issue
PORTAL session NOT PortletSession
mail upon registration
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 13:33:31.