Mailer Viewtool

Last Updated: Jun 17, 2024
documentation for the dotCMS Content Management System

The mailer tool is a simple email sender viewtool for dotCMS.

The following example shows how the mailer tool is mapped in the toolbox.xml file:

    <tool>
        <key>mailer</key>
        <scope>application</scope>
        <class>com.dotcms.rendering.velocity.viewtools.MailerTool</class>
    </tool>

Example

Send email example using mailer tool:

---
void            |   init(Object obj) Init Method for the viewtool
String          |   sendEmail(String to, String from, String subject, String message, Boolean html)  
---  

public String sendEmail(String to,
                        String from,
                        String subject,
                        String message,
                        Boolean html)

Sends an email Example: #set($error = $mailer.sendEmail( 'them@theirdomain.com', 'you@yourdomain.com', 'The Subject', 'The Message', false)) #if($UtilMethods.isSet($error)) ## Custom Error Handling #else

Your message was sent
#end

Parameters:

to - email address to send to
from - email address to send from
subject - subject of the email
message - the message to send
html - Whether or not to send it in HTML  

Returns:

Empty if Successful, or the error message otherwise 

On this page

×

We Dig Feedback

Selected excerpt:

×