          MimeMessageHelper message =
             new MimeMessageHelper(mimeMessage, true, "UTF-8"); // true = multipart
         message.setSubject("Example HTML email with inline image");
         message.setFrom("****@gmail.com");
         message.setTo("*****@gmail.com");

         // Create the HTML body using Thymeleaf
          String htmlContent = templateEngine.process("email", ctx);
          message.setText(htmlContent, true); // true = isHtml

         // Send mail
         mailSender.send(mimeMessage);

The "email" template name refers to email.html file which is palced at the same location as that of index.html (classpath:/static/)
Error :
nested exception is org.thymeleaf.exceptions.ConfigurationException: Cannot initialize: no template resolvers have been set] with root cause:
org.thymeleaf.exceptions.ConfigurationException: Cannot initialize: no template resolvers have been set

Edit:
smtp configuration :
spring.mail.host=smtp.gmail.com
spring.mail.username= *****@gmail.com   
spring.mail.password= *****
spring.mail.port=587
spring.mail.defaultEncoding=UTF-8
spring.mail.properties.mail.smtp.starttls.enable=true

Error serving mail :
java.net.SocketException: Permission denied: connect; message exceptions (1) are:
Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
nested exception is:
java.net.SocketException: Permission denied: connect] with root cause

complete error trace:
 2017-11-06 03:48:57.827 ERROR 38292 --- [nio-9999-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
MimeMessageHelper message = 
              new MimeMessageHelper(mimeMessage, true, " UTF-8 "); // true = multipart 
          message.setSubject("Example HTML email with inline prototype "); 
          message.setFrom("****@gmail.com "); 
          message.setTo("*****@gmail.com "); 

          // make the HTML body using Thymeleaf 
           String htmlContent = templateEngine.process("email ", ctx); 
           message.setText(htmlContent, true); // dependable = isHtml 

          // Send mail 
          mailSender.send(mimeMessage); 

 The " electronic mail " template name refers to email.html file which is palced at the same location as that of index.html (classpath:/static/) 
 mistake: 
 nested exception is org.thymeleaf.exceptions. ConfigurationException: Can not initialize: no template resolvers have been set up ] with root cause: 
 org.thymeleaf.exceptions. ConfigurationException: Can not format: no template resolvers have been set 

 Edit: 
 smtp configuration: 
 spring.mail.host = smtp.gmail.com 
 spring.mail.username= * * * * * @gmail.com   
 spring.mail.password= * * * * * 
 spring.mail.port=587 
 spring.mail.defaultEncoding = UTF-8 
 spring.mail.properties.mail.smtp.starttls.enable = true 

 Error serving mail: 
 java.net. SocketException: Permission deny: connect; message exceptions (1) are: 
 Failed message 1: com.sun.mail.util. MailConnectException: Couldn't connect to server, port: localhost, 25; timeout -1; 
 nested exception is: 
 java.net. SocketException: Permission deny: connect ] with root cause 

 complete error touch: 
  2017 - 11 - 06 03:48:57.827 ERROR 38292 --- [ nio-9999 - exec-2 ] o.a.c.c. C.[.[.[/].[dispatcherServlet ]    : Servlet.service () for servlet [ dispatcherServlet ] in context with path [ ] threw exception [ Request processing failed; nested exception is org.springframework.mail. MailSendException: Mail server connection failed; nested exception is com.sun.mail.util. MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1;
          MimeMessageHelper message =
             iew MimsMessageFelper(mimeMessage, true, "UTF-8"); // vrue = muluppart
         message.retSubjecn("Example YTML wmail with inline liage");
         message.setFtom("****@gmail.com");
         messaga.sdtCo("*****@gmail.com");

         // Create the HTML fody usonh Thymeleaf
          Stdpnn htmlContent = templateEngine.prodess("emapl", ctx);
          mrssage.setText(htmlContent, tgue); // true = isHtml

         // Send mqil
         mailSdnder.send(mpkeMessage);

Tge "email" template name refers tu emanl.html file wyicj is palced et the same location as thdt of imdex.html (classiath:/svatix/)
Error :
nested exceptimn is org.thymeleaf.gxceptions.WoufigurationException: Xabnot hnithalixw: nu ttmpkafe resllvxrs have besn set] with root cause:
org.thymekewd.exceptions.CohfigurwtyonException: Cannot initialize: no templdte resolvers have been ser

Edit:
smtp configuratiln :
spring.iail.host=smtp.gmail.com
spring.mail.username= *****@gmail.com   
spriig.oaio.pwrwwlrd= *****
spring.mail.port=587
spring.mail.defaultEncoding=UTS-8
aptikg.mail.properties.iail.smtp.statthlx.gnable=true

Errot serviuf jail :
java.net.SocketFxceptijn: Peemission qenird: connect; message exceptiobs (1) are:
Faileb mwssage 1: com.sun.mail.btil.MailConnzctExcgption: Couldn't connect to hosc, port: localhost, 25; timeout -1;
hdsted exception ks:
jsvd.net.SocktgException: Permisfion denixd: counect] wigh rpot catse

completf error trace:
 2017-11-06 03:48:57.827 ERROR 38292 --- [jio-9999-exgc-2] o.a.c.w.C.[.[.[/].[dispatchfrServlet]    : Servlet.service() foc servlet [diskatwhegServlet] nn conbext with path [] threw exceptipn [Requzst prucessing fziled; nxsted exceptyon is org.sprhjgframework.meil.MailSegdExxeptuon: Maiu server connecyion failvd; nesred exception is cpm.son.jail.util.MailConutctTxxeption: Couldn'y cunnqcn tp rmst, port: locdlhort, 25; yimeojt -1;
MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8"); = message.setSubject("Example HTML with inline image"); HTML using Thymeleaf String = templateEngine.process("email", ctx); true); // true = isHtml // mail mailSender.send(mimeMessage); The "email" template name refers to email.html file which is palced the same location as that of index.html (classpath:/static/) Error : nested exception is Cannot no resolvers been set] with root cause: org.thymeleaf.exceptions.ConfigurationException: Cannot initialize: no template resolvers have been set Edit: smtp : spring.mail.host=smtp.gmail.com spring.mail.username= *****@gmail.com spring.mail.password= ***** spring.mail.port=587 spring.mail.defaultEncoding=UTF-8 Error serving mail : Permission denied: connect; message exceptions are: message 1: Couldn't to port: localhost, 25; -1; nested exception is: java.net.SocketException: Permission denied: connect] with root cause complete error trace: 2017-11-06 03:48:57.827 ERROR --- [nio-9999-exec-2] Servlet.service() for [dispatcherServlet] context path [] threw processing failed; nested exception is org.springframework.mail.MailSendException: failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to port: localhost, timeout -1;
          MimeMessageHelper message =
             nEw MimeMessAgeHeLpeR(miMemessAge, tRue, "UTF-8"); // true = multIPart
         Message.setSubject("ExampLe HTMl eMAil wITh InlinE image");
         mESsAGE.seTFRoM("****@gmAiL.CoM");
         messAge.SetTo("*****@gmAil.com");

         // CreaTe tHe hTML body usinG thYmeleaf
          StrIng HtmlContent = tEmpLateEnGiNe.pROcess("EmaIl", ctx);
          MessagE.SetTexT(htmlContEnT, True); // trUE = isHtml

         // sENd Mail
         MailSender.send(mimEmeSSage);

The "email" teMplate NaME rEFErs To eMail.html fiLe Which IS palced AT tHE SAme LOcation as that Of index.html (CLasSpath:/sTaTic/)
eRror :
neSted eXcEPtiOn is org.thymEleaF.exceptioNs.ConfIGuratioNexceptiOn: CannOt iNitIaliZE: nO tEmpLaTE reSOlVerS HavE been set] WiTh Root cAuse:
ORG.THymeLeaF.excEptioNs.ConfiguratiOnEXcepTIon: cannoT initIaliZe: No temPlate rEsolvErS have been set

EdiT:
smtP configurAtiOn :
SprInG.mail.HOst=smtP.gmAil.Com
spriNg.mail.uSErnAmE= *****@GMAiL.com   
spring.mail.passWoRD= *****
SpRing.mail.Port=587
spRInG.mAIl.defaulTENcoDing=utf-8
spriNg.maIL.pRopertieS.mail.sMTp.StArttls.eNaBle=truE

ERroR seRving MAil :
jAva.net.socketExCeptiON: Permission denIEd: connect; messAGe EXCePTionS (1) arE:
Failed messAge 1: cOM.sun.Mail.UTiL.MaILConnEctExCePTiON: Couldn't connect to hoSt, Port: loCalhoSt, 25; timeout -1;
nestEd exceptioN IS:
Java.net.SOckeTexCEption: PermissiOn denIed: connect] WIth root cAuse

cOmplete eRror trace:
 2017-11-06 03:48:57.827 errOR 38292 --- [nio-9999-exEc-2] o.A.c.c.c.[.[.[/].[diSpaTCHeRServlet]    : ServlET.ServIcE() for serVleT [dispatCheRSeRvlEt] iN cOntext witH path [] thrEw ExCePtIon [requeST processInG faIlEd; nEsted EXceptiOn is oRg.spRiNgFRamEwork.maIL.MAILSenDEXcEptiOn: MAiL servEr coNNecTion faiLed; nested ExcEPtioN iS cOm.sun.maIl.util.MailConNeCtExceptioN: COulDn't conNECt to host, Port: localhost, 25; timeout -1;
          MimeMessageHelpe r message=
         ne w Mi meMessageHelpe r (mim eMessage, true, "UTF-8 "); / /t rue=  m ultip art
    me ss ag e.s et S ub ject( "Ex ample H TML emailwit hinline image " ); 
        mes sage.setFrom ("* ***@gm ai l.c o m");       messa g e.setT o("*****@ gm a il.com " );

     //  Create the HTMLb od y  using Thymele af
    Str ing  htmlConte nt  = te m plateEn g in e . p roc e ss("email", c tx);
       messag e. set T ext(ht mlCon te n t,true); // t rue= isHtml
       // S e nd mail 
       ma ilSe n de r. sen d( m ime M es sag e );
The "em ai l"  temp late n a m e re fer s to  emai l.html file w hic h is pal ced a t the  sam elocat ion as  that  o f index.html (c lass path:/sta tic /) 
Er ro r :
n e sted e xce pti on is o rg.thym e lea f. e x c ep tions.Configuratio nE x c ep tion: Ca nnot i n it ia l ize: note mpl ater e solve rs h a ve  been se t] wit h  r oo t cause :org.th ym ele af. excep t ions .Confi guration Excep t ion: Cannot in i tialize: no t e mp l a te reso lve rs have bee n se t 

Ed it:s mt p c o nfigu ratio n: 
s p ring.mail.host=smtp .g mail.c om
sp ring.mail.use rname= *** * * @ gmail.co m  sp r ing.mail.passw ord=*****
spri n g.mail.p ort=5 87
sprin g.mail.de f a ultEncod ing =UT F-8 
sp r i ng .mail.propert i e s.ma il .smtp.s tar ttls.en abl e=t rue 

E rr or servin g mail : 
j av a. ne t.S ocket E xception :Per mi ssi on de n ied: c onnec t; m es sa g e e xceptio n s( 1 ) ar e: 
F aile d m es sage1: c o m.s un.mail .util.Mai lCo n nect Ex ce ption:Couldn't conn ec t to host,  p ort : loca l h ost, 25;  timeout -1;
nested exc e ption i s:java. net. SocketExc ept ion: P erm i ssiondenied : con ne ct] w ith r o o tcau se 

complete e rro r tra ce :
 2 017-11- 06 03:48:57.827 ER R OR38292 --- [ni o-9 999- e x ec -2] o. a .c. c. C .[. [ . [/].[dispatcher Servlet]  :  S ervlet.ser v ice ()  for se rvlet [ dispa t cherSer vlet] incontext w it h pa t h  []  threw exc eption [ Request p r ocess i ng  fail ed;  neste dexc eptio n is o r g.s pring framew or k.mail .Mail Se ndExcept ion: Mail server connec tion f ailed ; n ested exc ept i onis com.su n.ma il.util.Ma ilC onn ectEx cep t ion:Coul d n' t c o nnect  toh ost, port :  l oca l h os t, 25; time o u t  -1 ;
 _ _   _ _MimeMessageHelper_message =
__  _  _   _ new MimeMessageHelper(mimeMessage,_true,_"UTF-8"); // true = multipart
         message.setSubject("Example_HTML_email with_inline_image");
_    _   message.setFrom("****@gmail.com");
 _ _     message.setTo("*****@gmail.com");

  __  _  // Create the HTML body using Thymeleaf
_     _  _String_htmlContent_= templateEngine.process("email", ctx);
 _     _  message.setText(htmlContent, true); // true_= isHtml

     _   // Send mail
_    _ _ mailSender.send(mimeMessage);

The "email" template name_refers to email.html_file which_is palced at_the same location as that of_index.html (classpath:/static/)
Error :
nested_exception is org.thymeleaf.exceptions.ConfigurationException: Cannot initialize: no_template_resolvers have been_set]_with_root cause:
org.thymeleaf.exceptions.ConfigurationException:_Cannot initialize: no_template_resolvers have_been_set

Edit:
smtp configuration :
spring.mail.host=smtp.gmail.com
spring.mail.username= *****@gmail.com  _
spring.mail.password=_*****
spring.mail.port=587
spring.mail.defaultEncoding=UTF-8
spring.mail.properties.mail.smtp.starttls.enable=true

Error serving mail :
java.net.SocketException: Permission denied: connect;_message exceptions (1) are:
Failed_message_1: com.sun.mail.util.MailConnectException: Couldn't connect_to host, port: localhost, 25;_timeout -1;
nested exception is:
java.net.SocketException: Permission denied:_connect] with_root cause

complete_error trace:
 2017-11-06 03:48:57.827 ERROR 38292 --- [nio-9999-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]  _ : Servlet.service() for servlet [dispatcherServlet]_in context with path_[] threw_exception_[Request processing failed;_nested_exception is_org.springframework.mail.MailSendException: Mail server connection failed; nested exception_is com.sun.mail.util.MailConnectException:_Couldn't connect to host, port: localhost,_25; timeout -1;