[make it easy] Send to Gmail SMTP

Gmail's SMTP is available for free. This is very helpful for system development. This time, I will use efw's email sending module to send to Gmail's SMTP.
# Gmail App Password Creation
Click the "Security" icon from the site menu on the Google account management screen, and select 2-step verification under "How to log in to Google" from the right side.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/3f4f3ec5-5a85-5c0d-3c66-faae50d5f358.png)
Scroll all the way to the end to find "App Password".
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/92b078e7-634f-f42d-f001-70d3f4121ece.png)
Select email and Win PC and press the create button to create a password.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/4720c3ec-f4b9-074d-b1cc-a856825a34d8.png)

# Efw context.xml Settings
Set the resources in context.xml as below. The name is "mail/efw". This is the value of efw.mail.resource defined in efw.properties.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Context>
<Context>
	<Resource
		name			=	"mail/efw" 
		auth			=	"Container"
		type			=	"javax.mail.Session"
		username		=	"[your account]@gmail.com"
		password		=	"[your password]"
		mail.debug		=   "false"
		mail.user		=	"[your account]@gmail.com"
		mail.from		=	"[your account]@gmail.com"
		mail.transport.protocol="smtp" 
		mail.smtp.host	=	"smtp.gmail.com"
		mail.smtp.auth	=	"true"
		mail.smtp.port	=	"587"
		mail.smtp.starttls.enable="true"
		description		=	"E-Mail Resource"
	/>
</Context>
```
Please refer to the table below for the attributes that can be set for email resources.
<TABLE>
<TR><TH>Name</TH><TH>Type</TH><TH>Description</TH></TR>
<TR><TD><A NAME="mail.smtp.user">mail.smtp.user</A></TD><TD>String</TD><TD>Default user name for SMTP.</TD></TR>
<TR><TD><A NAME="mail.smtp.host">mail.smtp.host</A></TD><TD>String</TD><TD>The SMTP server to connect to.</TD></TR>
<TR><TD><A NAME="mail.smtp.port">mail.smtp.port</A></TD><TD>int</TD><TD>The SMTP server port to connect to, if the connect() method doesn't explicitly specify one. Defaults to 25.</TD></TR>
<TR><TD><A NAME="mail.smtp.connectiontimeout">mail.smtp.connectiontimeout</A></TD><TD>int</TD><TD>Socket connection timeout value in milliseconds.This timeout is implemented by java.net.Socket.Default is infinite timeout.</TD></TR>
<TR><TD><A NAME="mail.smtp.timeout">mail.smtp.timeout</A></TD><TD>int</TD><TD>Socket read timeout value in milliseconds.This timeout is implemented by java.net.Socket.Default is infinite timeout.</TD></TR>
<TR><TD><A NAME="mail.smtp.writetimeout">mail.smtp.writetimeout</A></TD><TD>int</TD><TD>Socket write timeout value in milliseconds.This timeout is implemented by using a java.util.concurrent.ScheduledExecutorService per connectionthat schedules a thread to close the socket if the timeout expires.Thus, the overhead of using this timeout is one thread per connection.Default is infinite timeout.</TD></TR>
<TR><TD><A NAME="mail.smtp.from">mail.smtp.from</A></TD><TD>String</TD><TD>Email address to use for SMTP MAIL command.  This sets the envelope return address.  Defaults to msg.getFrom() or InternetAddress.getLocalAddress().  NOTE: mail.smtp.user was previously used for this.</TD></TR>
<TR><TD><A NAME="mail.smtp.localhost">mail.smtp.localhost</A></TD><TD>String</TD><TD>Local host name used in the SMTP HELO or EHLO command.Defaults to <code>InetAddress.getLocalHost().getHostName()</code>.Should not normally need to be set if your JDK and your name service are configured properly.</TD></TR>
<TR><TD><A NAME="mail.smtp.localaddress">mail.smtp.localaddress</A></TD><TD>String</TD><TD>Local address (host name) to bind to when creating the SMTP socket. Defaults to the address picked by the Socket class. Should not normally need to be set, but useful with multi-homed hosts where it's important to pick a particular local address to bind to.</TD></TR>
<TR><TD><A NAME="mail.smtp.localport">mail.smtp.localport</A></TD><TD>int</TD><TD>Local port number to bind to when creating the SMTP socket. Defaults to the port number picked by the Socket class. </TD></TR>
<TR><TD><A NAME="mail.smtp.ehlo">mail.smtp.ehlo</A></TD><TD>boolean</TD><TD>If false, do not attempt to sign on with the EHLO command.  Defaults to true.  Normally failure of the EHLO command will fallback to the HELO command; this property exists only for servers that don't fail EHLO properly or don't implement EHLO properly.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth">mail.smtp.auth</A></TD><TD>boolean</TD><TD>If true, attempt to authenticate the user using the AUTH command. Defaults to false.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.mechanisms">mail.smtp.auth.mechanisms</A></TD><TD>String</TD><TD>If set, lists the authentication mechanisms to consider, and the order in which to consider them.  Only mechanisms supported by the server and supported by the current implementation will be used.The default is <code>"LOGIN PLAIN DIGEST-MD5 NTLM"</code>, which includes all the authentication mechanisms supported by the current implementation except XOAUTH2.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.login.disable">mail.smtp.auth.login.disable</A></TD><TD>boolean</TD><TD>If true, prevents use of the <code>AUTH LOGIN</code> command. Default is false.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.plain.disable">mail.smtp.auth.plain.disable</A></TD><TD>boolean</TD><TD>If true, prevents use of the <code>AUTH PLAIN</code> command. Default is false.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.digest-md5.disable">mail.smtp.auth.digest-md5.disable</A></TD><TD>boolean</TD><TD>If true, prevents use of the <code>AUTH DIGEST-MD5</code> command. Default is false.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.ntlm.disable">mail.smtp.auth.ntlm.disable</A></TD><TD>boolean</TD><TD>If true, prevents use of the <code>AUTH NTLM</code> command. Default is false.</TD></TR>
<TR><TD><A NAME="mail.smtp.auth.ntlm.domain">mail.smtp.auth.ntlm.domain</A></TD><TD>String</TD><TD>The NTLM authentication domain. </TD></TR>
<TR><TD><A NAME="mail.smtp.auth.ntlm.flags">mail.smtp.auth.ntlm.flags</A></TD><TD>int</TD><TD>NTLM protocol-specific flags. See <A HREF="http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags" TARGET="_top">http://curl.haxx.se/rfc/ntlm.html#theNtlmFlags</A> for details. </TD></TR><!--<TR><TD><A NAME="mail.smtp.auth.ntlm.unicode">mail.smtp.auth.ntlm.unicode</A></TD><TD>boolean</TD><TD>Set this to "true" if the username or password may useUnicode UTF-8 encoded characters.  Default is "true". Currently has no effect. </TD></TR>
<TR><TD><A NAME="mail.smtp.auth.ntlm.lmcompat">mail.smtp.auth.ntlm.lmcompat</A></TD><TD>int</TD><TD>Sets the LM compatibility level, as described here:<A HREF="http://curl.haxx.se/rfc/ntlm.html#ntlmVersion2" TARGET="_top">http://curl.haxx.se/rfc/ntlm.html#ntlmVersion2</A>Defaults to "3".  Currently not used. </TD></TR>--><TR><TD><A NAME="mail.smtp.auth.xoauth2.disable">mail.smtp.auth.xoauth2.disable</A></TD><TD>boolean</TD><TD>If true, prevents use of the <code>AUTHENTICATE XOAUTH2</code> command. Because the OAuth 2.0 protocol requires a special access token instead ofa password, this mechanism is disabled by default.  Enable it by explicitlysetting this property to "false" or by setting the "mail.smtp.auth.mechanisms"property to "XOAUTH2".</TD></TR>
<TR><TD><A NAME="mail.smtp.submitter">mail.smtp.submitter</A></TD><TD>String</TD><TD>The submitter to use in the AUTH tag in the MAIL FROM command. Typically used by a mail relay to pass along information about theoriginal submitter of the message. See also the <a href="../../../../com/sun/mail/smtp/SMTPMessage.html#setSubmitter-java.lang.String-"><code>setSubmitter</code></a>method of <a href="../../../../com/sun/mail/smtp/SMTPMessage.html" title="class in com.sun.mail.smtp"><code>SMTPMessage</code></a>. Mail clients typically do not use this. </TD></TR>
<TR><TD><A NAME="mail.smtp.dsn.notify">mail.smtp.dsn.notify</A></TD><TD>String</TD><TD>The NOTIFY option to the RCPT command.  Either NEVER, or somecombination of SUCCESS, FAILURE, and DELAY (separated by commas).</TD></TR>
<TR><TD><A NAME="mail.smtp.dsn.ret">mail.smtp.dsn.ret</A></TD><TD>String</TD><TD>The RET option to the MAIL command.  Either FULL or HDRS.</TD></TR>
<TR><TD><A NAME="mail.smtp.allow8bitmime">mail.smtp.allow8bitmime</A></TD><TD>boolean</TD><TD>If set to true, and the server supports the 8BITMIME extension, textparts of messages that use the "quoted-printable" or "base64" encodingsare converted to use "8bit" encoding if they follow the RFC2045 rulesfor 8bit text. </TD></TR>
<TR><TD><A NAME="mail.smtp.sendpartial">mail.smtp.sendpartial</A></TD><TD>boolean</TD><TD>If set to true, and a message has some valid and some invalidaddresses, send the message anyway, reporting the partial failure witha SendFailedException.  If set to false (the default), the message isnot sent to any of the recipients if there is an invalid recipientaddress. </TD></TR>
<TR><TD><A NAME="mail.smtp.sasl.enable">mail.smtp.sasl.enable</A></TD><TD>boolean</TD><TD>If set to true, attempt to use the javax.security.sasl package tochoose an authentication mechanism for login. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.sasl.mechanisms">mail.smtp.sasl.mechanisms</A></TD><TD>String</TD><TD>A space or comma separated list of SASL mechanism names to tryto use. </TD></TR>
<TR><TD><A NAME="mail.smtp.sasl.authorizationid">mail.smtp.sasl.authorizationid</A></TD><TD>String</TD><TD>The authorization ID to use in the SASL authentication. If not set, the authentication ID (user name) is used. </TD></TR>
<TR><TD><A NAME="mail.smtp.sasl.realm">mail.smtp.sasl.realm</A></TD><TD>String</TD><TD>The realm to use with DIGEST-MD5 authentication.</TD></TR>
<TR><TD><A NAME="mail.smtp.sasl.usecanonicalhostname">mail.smtp.sasl.usecanonicalhostname</A></TD><TD>boolean</TD><TD>If set to true, the canonical host name returned by<a href="http://docs.oracle.com/javase/8/docs/api/java/net/InetAddress.html?is-external=true#getCanonicalHostName--" title="class or interface in java.net"><code>InetAddress.getCanonicalHostName</code></a>is passed to the SASL mechanism, instead of the host name used to connect. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.quitwait">mail.smtp.quitwait</A></TD><TD>boolean</TD><TD>If set to false, the QUIT command is sentand the connection is immediately closed. If set to true (the default), causes the transport to waitfor the response to the QUIT command. </TD></TR>
<TR><TD><A NAME="mail.smtp.reportsuccess">mail.smtp.reportsuccess</A></TD><TD>boolean</TD><TD>If set to true, causes the transport to include an<a href="../../../../com/sun/mail/smtp/SMTPAddressSucceededException.html" title="class in com.sun.mail.smtp"><code>SMTPAddressSucceededException</code></a>for each address that is successful. Note also that this will cause a<a href="../../../../javax/mail/SendFailedException.html" title="class in javax.mail"><code>SendFailedException</code></a>to be thrown from the<a href="../../../../com/sun/mail/smtp/SMTPTransport.html#sendMessage-javax.mail.Message-javax.mail.Address:A-"><code>sendMessage</code></a>method of<a href="../../../../com/sun/mail/smtp/SMTPTransport.html" title="class in com.sun.mail.smtp"><code>SMTPTransport</code></a>even if all addresses were correct and the message was sentsuccessfully. </TD></TR>
<TR><TD><A NAME="mail.smtp.socketFactory">mail.smtp.socketFactory</A></TD><TD>SocketFactory</TD><TD>If set to a class that implements the<code>javax.net.SocketFactory</code> interface, this classwill be used to create SMTP sockets.  Note that this is aninstance of a class, not a name, and must be set using the<code>put</code> method, not the <code>setProperty</code> method. </TD></TR>
<TR><TD><A NAME="mail.smtp.socketFactory.class">mail.smtp.socketFactory.class</A></TD><TD>String</TD><TD>If set, specifies the name of a class that implements the<code>javax.net.SocketFactory</code> interface.  This classwill be used to create SMTP sockets. </TD></TR>
<TR><TD><A NAME="mail.smtp.socketFactory.fallback">mail.smtp.socketFactory.fallback</A></TD><TD>boolean</TD><TD>If set to true, failure to create a socket using the specifiedsocket factory class will cause the socket to be created usingthe <code>java.net.Socket</code> class. Defaults to true. </TD></TR>
<TR><TD><A NAME="mail.smtp.socketFactory.port">mail.smtp.socketFactory.port</A></TD><TD>int</TD><TD>Specifies the port to connect to when using the specified socketfactory. If not set, the default port will be used. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.enable">mail.smtp.ssl.enable</A></TD><TD>boolean</TD><TD>If set to true, use SSL to connect and use the SSL port by default. Defaults to false for the "smtp" protocol and true for the "smtps" protocol. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.checkserveridentity">mail.smtp.ssl.checkserveridentity</A></TD><TD>boolean</TD><TD>If set to true, check the server identity as specified by<A HREF="http://www.ietf.org/rfc/rfc2595.txt" TARGET="_top">RFC 2595</A>. These additional checks based on the content of the server's certificateare intended to prevent man-in-the-middle attacks. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.trust">mail.smtp.ssl.trust</A></TD><TD>String</TD><TD>If set, and a socket factory hasn't been specified, enables use of a<a href="../../../../com/sun/mail/util/MailSSLSocketFactory.html" title="class in com.sun.mail.util"><code>MailSSLSocketFactory</code></a>. If set to "*", all hosts are trusted. If set to a whitespace separated list of hosts, those hosts are trusted. Otherwise, trust depends on the certificate the server presents. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.socketFactory">mail.smtp.ssl.socketFactory</A></TD><TD>SSLSocketFactory</TD><TD>If set to a class that extends the<code>javax.net.ssl.SSLSocketFactory</code> class, this classwill be used to create SMTP SSL sockets.  Note that this is aninstance of a class, not a name, and must be set using the<code>put</code> method, not the <code>setProperty</code> method. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.socketFactory.class">mail.smtp.ssl.socketFactory.class</A></TD><TD>String</TD><TD>If set, specifies the name of a class that extends the<code>javax.net.ssl.SSLSocketFactory</code> class.  This classwill be used to create SMTP SSL sockets. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.socketFactory.port">mail.smtp.ssl.socketFactory.port</A></TD><TD>int</TD><TD>Specifies the port to connect to when using the specified socketfactory. If not set, the default port will be used. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.protocols">mail.smtp.ssl.protocols</A></TD><TD>string</TD><TD>Specifies the SSL protocols that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptableto the <code>javax.net.ssl.SSLSocket.setEnabledProtocols</code> method. </TD></TR>
<TR><TD><A NAME="mail.smtp.ssl.ciphersuites">mail.smtp.ssl.ciphersuites</A></TD><TD>string</TD><TD>Specifies the SSL cipher suites that will be enabled for SSL connections. The property value is a whitespace separated list of tokens acceptableto the <code>javax.net.ssl.SSLSocket.setEnabledCipherSuites</code> method. </TD></TR>
<TR><TD><A NAME="mail.smtp.starttls.enable">mail.smtp.starttls.enable</A></TD><TD>boolean</TD><TD>If true, enables the use of the <code>STARTTLS</code> command (ifsupported by the server) to switch the connection to a TLS-protectedconnection before issuing any login commands. If the server does not support STARTTLS, the connection continues withoutthe use of TLS; see the<A HREF="#mail.smtp.starttls.required"><code>mail.smtp.starttls.required</code></A>property to fail if STARTTLS isn't supported. Note that an appropriate trust store must configured so that the clientwill trust the server's certificate. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.starttls.required">mail.smtp.starttls.required</A></TD><TD>boolean</TD><TD>If true, requires the use of the <code>STARTTLS</code> command. If the server doesn't support the STARTTLS command, or the commandfails, the connect method will fail. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.proxy.host">mail.smtp.proxy.host</A></TD><TD>string</TD><TD>Specifies the host name of an HTTP web proxy server that will be used forconnections to the mail server. </TD></TR>
<TR><TD><A NAME="mail.smtp.proxy.port">mail.smtp.proxy.port</A></TD><TD>string</TD><TD>Specifies the port number for the HTTP web proxy server. Defaults to port 80. </TD></TR>
<TR><TD><A NAME="mail.smtp.proxy.user">mail.smtp.proxy.user</A></TD><TD>string</TD><TD>Specifies the user name to use to authenticate with the HTTP web proxy server. By default, no authentication is done. </TD></TR>
<TR><TD><A NAME="mail.smtp.proxy.password">mail.smtp.proxy.password</A></TD><TD>string</TD><TD>Specifies the password to use to authenticate with the HTTP web proxy server. By default, no authentication is done. </TD></TR>
<TR><TD><A NAME="mail.smtp.socks.host">mail.smtp.socks.host</A></TD><TD>string</TD><TD>Specifies the host name of a SOCKS5 proxy server that will be used forconnections to the mail server. </TD></TR>
<TR><TD><A NAME="mail.smtp.socks.port">mail.smtp.socks.port</A></TD><TD>string</TD><TD>Specifies the port number for the SOCKS5 proxy server. This should only need to be used if the proxy server is not usingthe standard port number of 1080. </TD></TR>
<TR><TD><A NAME="mail.smtp.mailextension">mail.smtp.mailextension</A></TD><TD>String</TD><TD>Extension string to append to the MAIL command. The extension string can be used to specify standard SMTPservice extensions as well as vendor-specific extensions. Typically the application should use the<a href="../../../../com/sun/mail/smtp/SMTPTransport.html" title="class in com.sun.mail.smtp"><code>SMTPTransport</code></a>method <a href="../../../../com/sun/mail/smtp/SMTPTransport.html#supportsExtension-java.lang.String-"><code>supportsExtension</code></a>to verify that the server supports the desired service extension. See <A HREF="http://www.ietf.org/rfc/rfc1869.txt" TARGET="_top">RFC 1869</A>and other RFCs that define specific extensions. </TD></TR>
<TR><TD><A NAME="mail.smtp.userset">mail.smtp.userset</A></TD><TD>boolean</TD><TD>If set to true, use the RSET command instead of the NOOP commandin the <a href="../../../../javax/mail/Service.html#isConnected--"><code>isConnected</code></a> method. In some cases sendmail will respond slowly after many NOOP commands;use of RSET avoids this sendmail issue. Defaults to false. </TD></TR>
<TR><TD><A NAME="mail.smtp.noop.strict">mail.smtp.noop.strict</A></TD><TD>boolean</TD><TD>If set to true (the default), insist on a 250 response code from the NOOPcommand to indicate success.  The NOOP command is used by the<a href="../../../../javax/mail/Service.html#isConnected--"><code>isConnected</code></a> method to determineif the connection is still alive. Some older servers return the wrong response code on success, someservers don't implement the NOOP command at all and so always returna failure code.  Set this property to false to handle serversthat are broken in this way. Normally, when a server times out a connection, it will send a 421response code, which the client will see as the response to the nextcommand it issues. Some servers send the wrong failure response code when timing out aconnection. Do not set this property to false when dealing with servers that arebroken in this way. </TD></TR>
</TABLE>

https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html

# Jsp Source
```jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="efw" uri="efw" %>
<!DOCTYPE HTML>
<HTML>
<HEAD>
	<title>mail テスト</title>
	<efw:Client lang="jp"/>
</HEAD>
<BODY>
TO:<input type="text" id="txtTo"><br>
CC:<input type="text" id="txtCC"><br>
BCC:<input type="text" id="txtBCC"><br>
開封確認:<input type="text" id="txtMDN"><br>
発信者:<input type="text" id="txtFrom"><br>
名称:<input type="text" id="txtName"><br>
<button onclick="Efw('helloMail_submit')">メール送信</button>
<br>
</BODY>
</HTML>
```
# Js Event
```javascript
var helloMail_submit={};
helloMail_submit.paramsFormat={
	"#txtTo":null,
	"#txtName":null,
	"#txtCC":null,
	"#txtBCC":null,
	"#txtMDN":null,
	"#txtFrom":null,
};
helloMail_submit.fire=function(params){
	mail.send("mails","hello",{
		to:params["#txtTo"],
		nm:params["#txtName"],
		cc:params["#txtCC"],
		bcc:params["#txtBCC"],
		mdn:params["#txtMDN"],
		from:params["#txtFrom"],
	});
}
```

# efw Email Template
Register the email template in WEB-INF/efw/mail/mails.xml. As shown in the sample below, it supports a special feature called read receipt destination.
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mails>
<mails>
<!-- パスワード送信メール -->
	<mail id="hello">
		<to>:to</to><!-- 送信先 -->
		<cc>:cc</cc><!-- CC先 -->
		<bcc>:bcc</bcc><!-- BCC先 -->
		<mdn>:mdn</mdn><!-- 開封確認送信先 -->
		<from>:from</from><!-- 発信者 -->
		<subject>helloメール送信</subject>
		<body>
:nm 様：
テストです。
		</body>
	</mail>
</mails>
```
# Image of Test Page
Below is the test evidence. For caller settings, from defined in context.xml is enabled. The sender defined for individual emails is not yet enabled. I have not investigated this matter yet. It's TODO.
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/08be2e75-77e3-05ae-bf09-220697c93d66.png)
If you want to add a Japanese name to the recipient, you can edit the email address as shown below.
```xml
あいうえお<test@test.test>
```
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/3476221/ed7a83d7-355d-7630-5c30-5423916ad61d.png)

# Get Jar
Store efw-4.XX.XXX.jar in the app/WEB-INF/lib folder.
```xml
<dependency>
    <groupId>io.github.efwgrp</groupId>
    <artifactId>efw</artifactId>
    <version>4.07.029</version>
</dependency>
```
For jdk15 or higher, related jars are required.
```xml
<dependency>
    <groupId>org.openjdk.nashorn</groupId>
    <artifactId>nashorn-core</artifactId>
    <version>15.6</version>
</dependency>
```
Store javax.mail-1.6.2.jar in the tomcat/lib folder.
```xml
<dependency>
    <groupId>com.sun.mail</groupId>
    <artifactId>javax.mail</artifactId>
    <version>1.6.2</version>
</dependency>
```
If your JDK is Java 11 or later, you will also need javax.activation-1.2.0.jar. The location is tomcat/lib folder.
```xml
<dependency>
<groupId>com.sun.activation</groupId>
    <artifactId>javax.activation</artifactId>
	<version>1.2.0</version>
</dependency>
```

This sample can be downloaded from the link below.

https://github.com/efwGrp/qittaSamples