Formulář a třídy pro odesílání e-mailů. Implementováno odesílání PDF

sestav mailem.
This commit is contained in:
2014-07-02 16:21:24 +02:00
parent e26f56fcb9
commit 1283fe627d
13 changed files with 328 additions and 1 deletions
@@ -134,6 +134,12 @@ ReportTitle=Nadpis sestavy:
ReportOptions=Volby sestavy
ReportNoOptions=Žádná nestavení
MailForm=Odeslání e-mailu
MailFor=Komu:
MailSubject=Předmět:
MailSend=Odeslat
MailAttachement=Příloha:
Error=Chyba
ErrorRights=K vykobání této operace nemáte dostatečná oprávnění
+7
View File
@@ -0,0 +1,7 @@
mail.from=kosef.rokos@gmail.com
mail.host=smtp.gmail.com
mail.port=587
mail.useauth=true
mail.usessl=true
mail.username=josef.rokos@gmail.com
mail.password=XXXXXX
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.host}"/>
<property name="port" value="${mail.port}"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="defaultEncoding" value="UTF-8"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.useauth}</prop>
<prop key="mail.smtp.starttls.enable">${mail.usessl}</prop>
</props>
</property>
</bean>
<bean id="mailer" class="info.bukova.isspst.mail.MailerWithAttachement">
<constructor-arg ref="mailSender"/>
<property name="from" value="${mail.from}"/>
</bean>
<bean id="simpleMailer" class="info.bukova.isspst.mail.SimpleMailer">
<constructor-arg ref="mailSender"/>
<property name="from" value="${mail.from}"/>
</bean>
<!-- <bean id="mailer" class="info.bukova.rsfaktura.services.mail.ThreadMailer"> -->
<!-- <constructor-arg ref="attachementMailer"/> -->
<!-- </bean> -->
<!-- <bean id="attachementMailer" class="info.bukova.rsfaktura.services.mail.AttachementMailer"> -->
<!-- <constructor-arg ref="tmpStorage"/> -->
<!-- <property name="from" value="josef.rokos@gmail.com"/> -->
<!-- <property name="sender" ref="mailSender"/> -->
<!-- </bean> -->
<!-- <bean id="messageBuilder" class="info.bukova.rsfaktura.services.mail.MailMessageBuilder"> -->
<!-- <constructor-arg ref="tmpStorage"/> -->
<!-- </bean> -->
</beans>
@@ -16,6 +16,7 @@
<list>
<value>/WEB-INF/jdbc.properties</value>
<value>/WEB-INF/ldap.properties</value>
<value>/WEB-INF/mail.properties</value>
</list>
</property>
</bean>
@@ -75,6 +76,8 @@
<import resource="database-auth.xml"/>
<!-- <import resource="ldap-auth.xml"/> -->
<import resource="mail-services.xml"/>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetClass" value="org.springframework.security.core.context.SecurityContextHolder" />
+31
View File
@@ -0,0 +1,31 @@
<?page title="Mail" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window id="mailWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.mail.MailForm')" width="500px" closable="true">
<caption zclass="form-caption" label="${labels.MailForm}" />
<grid>
<columns>
<column hflex="min"/>
<column/>
</columns>
<rows>
<row>
<label value="${labels.MailFor}"/> <textbox value="@bind(vm.to)" width="100%"/>
</row>
<row>
<label value="${labels.MailSubject }"/> <textbox value="@bind(vm.message.subject)" width="100%"/>
</row>
<row>
<label value="${labels.MailAttachement}"/> <textbox value="@load(vm.attachement)" readonly="true" width="100%"/>
</row>
</rows>
</grid>
<vbox>
<ckeditor width="470px" height="200px" value="@bind(vm.message.text)" toolbar="Basic"/>
<hbox>
<button label="${labels.MailSend}" onClick="@command('send', window=mailWin)"/> <button label="${labels.ButtonStorno}" onClick="mailWin.detach()"/>
</hbox>
</vbox>
</window>
</zk>
+1 -1
View File
@@ -4,7 +4,7 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.reporting.ReportVM')">
<caption src="/img/print.png" zclass="form-caption" label="${labels.ReportReport}" />
<toolbar>
<toolbarbutton image="/img/send.png" tooltiptext="${labels.ReportSend}"/>
<toolbarbutton image="/img/send.png" tooltiptext="${labels.ReportSend}" onClick="@command('send')"/>
</toolbar>
<iframe width="800px" height="660px" src="/api/report.pdf"/>
</window>