-
-
Save ilmoralito/9691820 to your computer and use it in GitHub Desktop.
Sending email from quartz using some view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//in quartz job | |
package com.testing | |
class SampleJob { | |
def mailService | |
static triggers = { | |
simple repeatInterval: 10000l // execute job once in 100000 seconds, just to try something | |
} | |
def execute() { | |
mailService.sendMail { | |
to "amakenadog@gmail.com" | |
from "amakenadog@gmail.com" | |
subject "Hello" | |
body view:"/shared/templ", model:[users:User.list()] | |
} | |
println "Sended" | |
} | |
} | |
//view in /views/shared/templ.gsp | |
<%@ page contentType="text/html"%> | |
<h1>My users list</h1> | |
<ul> | |
<g:each in="${users}" var="${user}"> | |
<li>${user.username}</li> | |
</g:each> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment