i am creating a web application using jsf and primefaces, and my question is how to send an email through site's contact form (i've done this using php before, very easily, but never using jsf). I have created form on contact.xhtml page, as well as bean class to support that, and all that form should do is to send bean's data to a predefined mail (ie. gmail). I have also found several "tutorials" of how to send email using JavaMail, but nothing seems to work properly. The form itself, consists of name, email and message fields.
Can someone write how to do that, or give me a link. I would be very gratefull.
Do i need my site to be running on (online) server, or i can test it from localhost.
Thank you in advance.
In very short:
<h:commandButton action="#{yourBean.send}"
@ManagedBean("yourBean")
that has a send(..)
method(You should go through a JSF tutorial to see how to gather the form parameters)
Note that java is a bit more complex. "Send mail through JSF" isn't a particularly good question. It consists of two questions:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With