Jahia Dev Forum > How can i sent email

0 (0 Good)
0 (0 Bad)

How can i sent email

by  obayok »  2012/10/10 08:19

Hi, all.

I need to sent email, i fill my form and for submit action i have own action

public class SentMail extends Action {

    private MailService mailService;

    public ActionResult doExecute(HttpServletRequest req, RenderContext renderContext, Resource resource,
                                  JCRSessionWrapper session, Map<String, List<String>> parameters, URLResolver urlResolver) throws Exception {
        if (mailService.isEnabled()) {
            mailService.sendMessage("fromolga@mail.com","toolga@mail.com", "this is message");
        return new ActionResult(HttpServletResponse.SC_OK);

    public void setMailService(MailService mailService) {
        this.mailService = mailService;


but i recieve mail from address with i have in mail setting.



Can i use mailSevice for sent mail from user to any mail?




Number of messages  11
Registration date
0 (0 Good)
0 (0 Bad)

Re: How can i sent email

by  faissah »  2012/10/12 21:57


Yes, you can use mailSevice in order to send email, this is what we use for our default modules. Have you well setted and tested your email settings? (there is a test settings button in the "Email Settings" panel).

The "from" you setted there will be the sender of the email unless you provide one.

When the code is executed, do you have anything in the logs ?



Fabrice  (faissah)

Number of messages  262
Registration date

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page