Re: Pick up mailserver in a template?

Philippe Vollenweider <[email protected]>
Newsgroups gmane.comp.cms.jahia.template
Message-ID <[email protected]>
Yes, you can do this like this:

org.jahia.services.mail.MailService mailService =
     ServicesRegistry.getInstance().getMailService();
try {
     mailService.sendMessage (sender, recipients,
         recipientsCC, null, subject, body);
} catch (Throwable th) {
     %>Error while sending mail : <%=th.getMessage()%><%

}

Philippe.

At 21.10.2005 09:29, you wrote:
>I am sending mail from a template (posting parameters from a html 
>form) and everything works perfectly.
>
>Now I want to retreive configured mailserver from the server settings.
>
>What is the preferred way to do this.
>
>....
>String mailserver = ?;
>org.jahia.services.mail.MailService ms = 
>org.jahia.services.mail.MailService.getInstance();
>  ms.sendMessage(from,to,null,null,subject,mailserver,message );
>....
>
>Regards
>/Lars Hagrot
>
>
>...

-------=[ pvollenweider at jahia dot com ]=---------
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.