public void sendMail(Map<String, Object> context) {
		System.out.println(" :: SEND MAIL ::" + context);

		boolean smtpUseSSLFlag = true;

		String smtpUser = null;
		String smtpPassword = null;

		String from = (String) context.get("from");
		String subject = (String) context.get("subject");
		String smtpHost = null;// = (String) context.get("smtpHost");
		String smtpPort = null;// = (String) context.get("smtpPort");
		String message = (String) context.get("message");
		String event = (String) context.get("type");
		String source = (String) context.get("source");

		SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy");
		String content = "";

		content = message;

		Connection con = getConnection();
		String recipient = "";
		try {
			java.sql.Statement stmt = con.createStatement();

			ResultSet rs = stmt
					.executeQuery("select recipients from pa_recipients_by_event where event= 'STC_ATN_END'");

			while (rs.next()) {
				recipient = rs.getString("recipients");

			}
		} catch (SQLException ex) {

		}

		String to = recipient;

		java.sql.Statement stmt;
		try {
			stmt = con.createStatement();

			ResultSet rs = stmt.executeQuery("select emailPort,emailServer,password,  "
					+ " senderEmail from bpm_db.pa_email_configuration");

			while (rs.next()) {
				smtpHost = rs.getString("emailServer");
				smtpPort = rs.getString("emailPort");
				smtpUser = rs.getString("senderEmail");
				smtpPassword = rs.getString("password");
			}

		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		smtpUseSSLFlag = true;

		// smtpUser = "pablo.caceres@rhiscom.cl";
		// smtpPassword = "pablo2012";

		Properties props = System.getProperties();
		SMTPTransport t = null;

		if (smtpUseSSLFlag) {
			props.setProperty("mail.smtp.port", smtpPort);
			props.setProperty("mail.smtp.socketFactory.port", smtpPort);
			props.setProperty("mail.smtp.auth", "true");
			props.setProperty("mail.smtps.quitwait", "false");
			props.put("mail.debug", "false");
		} else {
			props.put("mail.smtp.host", smtpHost);
			props.put("mail.smtp.port", smtpPort);
			props.put("mail.smtp.auth", "true");
			props.put("mail.smtp.user", smtpUser);
			props.put("mail.smtp.password", smtpPassword);
			props.put("mail.debug", "true");
		}

		props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
		props.put("mail.smtp.socketFactory.fallback", "false");
		props.put("mail.smtp.starttls.enable", "true");

		javax.mail.Session session = javax.mail.Session.getInstance(props, null);

		SecurityManager security = System.getSecurityManager();

		System.out.println(" :: Security Manager ::" + security);

		if (security == null) {
			session = javax.mail.Session.getInstance(props);
		} else {
			session = javax.mail.Session.getDefaultInstance(props);
		}

		final MimeMessage msg = new MimeMessage(session);

		try {
			if (smtpUseSSLFlag) {
				t = (SMTPTransport) session.getTransport("smtp");
			} else {
				t = (SMTPTransport) session.getTransport("smtp");
			}
			String[] toArray = to.split(",");
			InternetAddress[] address = new InternetAddress[toArray.length];

			for (int i = 0; i <= toArray.length - 1; i++) {
				address[i] = new InternetAddress(toArray[i]);
			}

			msg.setFrom(new InternetAddress(from));
			msg.setRecipients(Message.RecipientType.TO, address);

			msg.setSubject(subject, "ISO-8859-1");
			msg.setContent(content, "text/html; charset=utf-8");
			msg.setSentDate(new java.util.Date());

			t.connect(smtpHost, smtpUser, smtpPassword);
			t.sendMessage(msg, msg.getAllRecipients());
			t.close();
		} catch (Exception ex) {
			ex.printStackTrace();
		}

	}