EnvioMail.java 22.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
package br.gov.mc.cadsei.util;

import java.util.List;

import org.springframework.web.util.HtmlUtils;

import br.gov.arquitetura.util.SpringUtil;
import br.gov.arquitetura.util.StringUtil;
import br.gov.mc.cadsei.entidade.CadEmpresa;
import br.gov.mc.cadsei.entidade.CadPeticao;
import br.gov.mc.cadsei.entidade.CadProcuracao;
import br.gov.mc.cadsei.entidade.CadProponente;
import br.gov.mc.corporativo.entidade.CrpContatoEmail;

public class EnvioMail {

	
        private static SimpleMail getInstance() {
		return (SimpleMail) SpringUtil.getBean("SimpleMail", "applicationContext-service.xml");
	}

	
	public static void sendEmail(CadProponente proponente, String descricao) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra.jpg\" style=\"width:881px;\" /> ");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		String login = StringUtil.format("###.###.###-##", proponente.getLoginProponente());
		text.append("Sr.(a) <b>" + HtmlUtils.htmlEscape(proponente.getPessoaProponente().getNome().toUpperCase()) + "</b> " + descricao + " <br/><br/>");
		text.append("Seu usu&aacute;rio &eacute; <b>" + login + "</b> e sua senha &eacute; a " + "<b>" + proponente.getSenha() + ".</b>");

		text.append("<br />");
		text.append("<br />");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Dados de Acesso ao Sistema.");
		text.toString();
		mail.addTO(proponente.getEmailProponente());
		mail.enviarEmail();
	}

	public static void sendEmailAprovacaoProponente(CadProponente proponente) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra.jpg\" style=\"width:881px;\" /> ");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(proponente.getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/><br/>");
		text.append("Seu cadastro de Pessoa F&iacute;sica foi aprovado.</b> <br/><br/>");
		text.append("Caso necessite cadastrar uma Pessoa Jur&iacute;dica, da qual &eacute; Representante Legal, acesse o Protocolo Eletrônico, com seu CPF e senha, e utilize a op&ccedil;&atilde;o 'Pessoa Jur&iacute;dica', dispon&iacute;vel no sistema. Este novo cadastro tamb&eacute;m ser&aacute; analisado pelo Minist&eacute;rio da Justi&ccedil;a. ");
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra_fim_cadsei.jpg\" style=\"width:881px; height:120px;\" /> ");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Cadastro Aprovado.");
		mail.addTO(proponente.getEmailProponente());
		mail.enviarEmail();
	}

	public static void sendEmailReprovacaoProponente(CadProponente proponente) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(proponente.getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/><br/>");
		text.append("Seu cadastro de Pessoa F&iacute;sica foi reprovado!");
		text.append("<br/>");
		text.append("<br/>");
		text.append("O motivo da reprova&ccedil;&atilde;o, informado pela  &aacute;rea respons&aacute;vel, est&aacute; disposto abaixo:");
		text.append("<br/>");
		text.append(HtmlUtils.htmlEscape(proponente.getDescricaoAnaliseTecnica()));
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Cadastro Reprovado.");
		mail.addTO(proponente.getEmailProponente());
		mail.enviarEmail();
	}
	
	public static void sendEmailMudancaStatusEmExigenciaProponente(CadProponente proponente) throws Exception {
		StringBuilder text = new StringBuilder("");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");
		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(proponente.getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/><br/>");

		text.append("Seu cadastro de Pessoa F&iacute;sica necessita dados complementares para a aprova&ccedil;&atilde;o</b>");

		text.append("<br/>");
		text.append("e est&#225; sendo analisado pela &#225;rea t&eacute;cnica e precisa atender &agrave;s exig&ecirc;ncias abaixo dispostas:");
		text.append("<br/>");
		text.append(HtmlUtils.htmlEscape(proponente.getDescricaoAnaliseTecnica()));
		text.append("<br/>");
		text.append("(Os dados fornecidos acima s&atilde;o de responsabilidade da &#225;rea de an&#225;lise de cadastros de Pessoas F&iacute;sicas).");
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra_fim_cadsei.jpg\" style=\"width:881px; height:120px;\" /> ");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] Cadastro de Pessoa Fisica necessita dados complementares para deferimento.");
		mail.addTO(proponente.getEmailProponente());
		mail.enviarEmail();
	}

	public static void sendEmailAprovacaoEmpresa(CadEmpresa empresa) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra.jpg\" style=\"width:881px;\" /> ");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(empresa.getProponente().getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/>");
		text.append("<br/>");
		text.append("O cadastro da Pessoa Jur&iacute;dica "+HtmlUtils.htmlEscape(empresa.getPessoaTitular().getRazaoSocial())+ " foi aprovado!</b> <br/>");
		text.append("<br/>");
		text.append("Agora voc&ecirc; pode encaminhar peti&ccedil;&otilde;es ao Minist&eacute;rio da Justi&ccedil;a tamb&eacute;m em nome da Pessoa Jur&iacute;dica aprovada.");
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra_fim_cadsei.jpg\" style=\"width:881px; height:120px;\" /> ");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		
		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Cadastro de Pessoa Juridica Aprovado.");
		mail.addTO(empresa.getProponente().getEmailProponente());
		mail.enviarEmail();
	}

	public static void sendEmailReprovacaoEmpresa(CadEmpresa empresa) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra.jpg\" style=\"width:881px;\" /> ");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(empresa.getProponente().getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/>");
		text.append("<br/>");
		text.append("Seu cadastro da Pessoa Jur&iacute;dica "+HtmlUtils.htmlEscape(empresa.getPessoaTitular().getRazaoSocial())+" foi reprovado!</b> <br/>");
		text.append("<br/>");
		text.append("O motivo da reprova&ccedil;&atilde;o, informado pela &aacute;rea respons&aacute;vel, est&aacute; disposto abaixo:");
		text.append("<br/>");
		text.append(HtmlUtils.htmlEscape(empresa.getDescricaoAnaliseTecnica()));
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra_fim_cadsei.jpg\" style=\"width:881px; height:120px;\" /> ");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] Cadastro de Pessoa Juridica foi reprovado");
		mail.addTO(empresa.getProponente().getEmailProponente());
		mail.enviarEmail();
	}

	

	public static void sendEmailMudancaStatusEmExigenciaEmpresa(CadEmpresa empresa) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra.jpg\" style=\"width:881px;\" /> ");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		text.append("Prezado Sr.(a) <b>" + HtmlUtils.htmlEscape(empresa.getProponente().getPessoaProponente().getNome().toUpperCase()) + "&#44; </b> <br/>");
		text.append("<br/>");
		text.append("Seu cadastro de Pessoa Jur&iacute;dica necessita dados complementares para a aprova&ccedil;&atilde;o.</b> <br/>");
		text.append("<br/>");
		text.append(" O cadastro da Pessoa Jur&iacute;dica "+ HtmlUtils.htmlEscape(empresa.getPessoaTitular().getRazaoSocial()));
		text.append("<br/>");
		text.append("est&#225; sendo analisado pela &#225;rea t&eacute;cnica e precisa atender &agrave;s exig&ecirc;ncias abaixo dispostas:");
		text.append("<br/>");
		text.append(HtmlUtils.htmlEscape(empresa.getDescricaoAnaliseTecnica()));
		text.append("<br/>");
		text.append("(Os dados fornecidos acima s&atilde;o de responsabilidade da &#225;rea de an&#225;lise de cadastros de Pessoas Jur&iacute;dicas).");
		text.append("<br/>");
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();

		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] Cadastro de Pessoa Jurídica necessita dados complementares para deferimento.");
		mail.addTO(empresa.getProponente().getEmailProponente());
		mail.enviarEmail();
	}

	public static void sendEmailProcuracao(CadProcuracao procuracao, List<CrpContatoEmail> listEmails) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico - Recebimento de Procura&ccedil;&atilde;o </title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");

		if(procuracao.getProponenteOutorgado() != null && procuracao.getProponenteOutorgado().getId() != null){
			text.append("Prezado(a) Sr(a). " + HtmlUtils.htmlEscape(procuracao.getProponenteOutorgado().getPessoaProponente().getNome()));
		} else {
			text.append("Prezado(a) Sr(a). " + HtmlUtils.htmlEscape(procuracao.getEmpresaOutorgado().getPessoaTitular().getRazaoSocial()));
		}
		text.append("<br/>");
		text.append("<br/>");
		
		if(procuracao.getProponenteOutorgante() != null && procuracao.getProponenteOutorgante().getId() != null){
			text.append("Foi concedida a voc&ecirc; uma Procura&ccedil;&atilde;o Eletr&ocirc;nica para representar " + HtmlUtils.htmlEscape(procuracao.getProponenteOutorgante().getPessoaProponente().getNome()));
		} else {
			text.append("Foi concedida a voc&ecirc; uma Procura&ccedil;&atilde;o Eletr&ocirc;nica para representar " + HtmlUtils.htmlEscape(procuracao.getEmpresaOutorgante().getPessoaTitular().getRazaoSocial()));
		}
		
		text.append("<br/>");
		text.append("Por meio desta procura&ccedil;&atilde;o você poder&aacute; apresentar peti&ccedil;&otilde;es em nome do outorgante junto ao Minist&eacute;rio da Justi&ccedil;a. Para visualizar a procura&ccedil;&atilde;o ou apresentar peti&ccedil;&otilde;es, acesse este link: [link tela SisProtocolo Eletrônico].");
		
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		//text.append("<img src=\"http://www.mc.gov.br/documentos/imagens/sistemas/barra_fim_cadsei.jpg\" style=\"width:881px; height:120px;\" /> ");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");

		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Recebimento de Peticionamento.");
		if(procuracao.getProponenteOutorgado() != null && procuracao.getProponenteOutorgado().getId() != null){
			mail.addTO(procuracao.getProponenteOutorgado().getEmailProponente());
		} else {
			if(!listEmails.isEmpty()){
				for(CrpContatoEmail email : listEmails){
					mail.addTO(email.getDescricao());	
					break;
				}
			}
		}
		mail.enviarEmail();
	}
	
	public static void sendEmailPeticionamento(CadPeticao peticao, String emailPara, String numeroProtocoloExistente) throws Exception {

		StringBuilder text = new StringBuilder("");
		text.append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		text.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		text.append("<head>");
		text.append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
		text.append("<title>Protocolo Eletrônico</title>");
		text.append("</head>");

		text.append("<body>");
		text.append("<div class=\"conteudo\" style=\"width:881px; height:100%; margin:5px; padding:5px;\">");

		text.append("<div class=\"cabecalho\" style=\"background: #FFFFFF; height:35px;\">");
		text.append("</div>");
		text.append("<div class=\"corpo\" style=\"font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif; color:#004B80; font-size:12px; line-height: 1.3em; margin-left:20px; margin-top:10px;\" >");
		
		text.append(" Prezado Sr. (a) "+HtmlUtils.htmlEscape(peticao.getProponente().getPessoaProponente().getNome().toUpperCase()));
		text.append("<br/>");
		text.append("<br/>");
		text.append("Sua peti&ccedil;&atilde;o foi enviada com sucesso, segue abaixo o n&uacute;mero do protocolo para que seja poss&iacute;vel acompanhar o andamento do processo.");
		text.append("<br/>");
		text.append("<br/>");
		if(numeroProtocoloExistente == null || numeroProtocoloExistente.isEmpty()){
			text.append(peticao.getNumeroProcessoFormatado());
		} else {
			text.append(peticao.getNumeroProcessoFormatado() + " com refer&ecirc;ncia ao processo " + numeroProtocoloExistente);
		}
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("<div class=\"rodape\" style=\"background: #FFFFFF; height:120px\">");
		text.append("Atenciosamente,");
		text.append("<br/>");
		text.append("<br/>");
		text.append("Protocolo Eletr&ocirc;nico");
		text.append("<br/>");
		text.append("<br/>");
		text.append("</div>");
		text.append("</div> </body></html>");

		SimpleMail mail = getInstance();
		mail.setText(text.toString());
		mail.setSubject("[Protocolo Eletrônico] - Recebimento de Peticionamento.");
		mail.addTO(emailPara);
		mail.enviarEmail();
	}
}