Skip to content

Commit e6205c4

Browse files
author
Vitalii Samolovskikh
committed
Message sending.
1 parent 89def0c commit e6205c4

File tree

4 files changed

+71
-3
lines changed

4 files changed

+71
-3
lines changed

grails-app/conf/Config.groovy

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.apache.log4j.Level;
12
// locations to search for config files that get merged into the main config;
23
// config files can be ConfigSlurper scripts, Java properties files, or classes
34
// in the classpath in ConfigSlurper format
@@ -120,10 +121,12 @@ log4j = {
120121
'net.sf.ehcache.hibernate'
121122

122123
// Enable the Asynchronous Mail plugin logging
123-
trace 'grails.app.jobs.grails.plugin.asyncmail', 'grails.app.services.grails.plugin.asyncmail'
124+
trace 'grails.app.jobs.grails.plugin.asyncmail',
125+
'grails.app.services.grails.plugin.asyncmail',
126+
'grails.plugin.asyncmail'
124127

125128
// Enable the Quartz plugin logging
126-
debug 'grails.plugins.quartz'
129+
debug 'grails.plugins.quartz'
127130
}
128131

129132
grails {

grails-app/conf/UrlMappings.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class UrlMappings {
77
}
88
}
99

10-
"/"(view:"/index")
10+
"/"(controller: 'mail')
1111
"500"(view:'/error')
1212
}
1313
}

grails-app/controllers/sample/MailController.groovy

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,15 @@ package sample
33
class MailController {
44

55
def index() {}
6+
7+
def send(){
8+
sendMail {
9+
from params.from
10+
to params.to
11+
subject params.subject
12+
text params.body
13+
}
14+
15+
redirect(controller: 'asynchronousMail', action: 'list')
16+
}
617
}

grails-app/views/mail/index.gsp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<%@ page contentType="text/html;charset=UTF-8" %>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
5+
<link rel="stylesheet" href="${resource(dir: 'css', file: 'asyncmail.css', plugin: 'asynchronous-mail')}"/>
6+
<title>Send a new message</title>
7+
</head>
8+
<body>
9+
<%-- Header --%>
10+
<h1>Edit Asynchronous Mail Message</h1>
11+
12+
<%-- Navigation --%>
13+
<div class="nav">
14+
<span class="menuButton"><a class="home" href="${resource(dir: '')}">Home</a></span>
15+
<span class="menuButton"><g:link class="list" controller="asynchronousMail" action="list">List</g:link></span>
16+
</div>
17+
18+
<%-- Flash message --%>
19+
<g:render template="/asynchronousMail/flashMessage"/>
20+
21+
<div class="body">
22+
<g:form method="post" action="send">
23+
<table>
24+
<tbody>
25+
<tr class="odd">
26+
<td class="fieldName">From:</td>
27+
<td><g:textField name="from"/></td>
28+
</tr>
29+
30+
<tr class="even">
31+
<td class="fieldName">To:</td>
32+
<td><g:textField name="to"/></td>
33+
</tr>
34+
35+
<tr class="odd">
36+
<td class="fieldName">Subject:</td>
37+
<td><g:textField name="subject"/></td>
38+
</tr>
39+
40+
<tr class="even">
41+
<td class="fieldName">Body:</td>
42+
<td><g:textArea name="body"/></td>
43+
</tr>
44+
</tbody>
45+
</table>
46+
47+
<div class="buttons">
48+
<span class="button"><g:submitButton class="save" name="Send"/></span>
49+
</div>
50+
</g:form>
51+
</div>
52+
53+
</body>
54+
</html>

0 commit comments

Comments
 (0)