package com.sendpulse;
import java.util.Map;

import com.sendpulse.restapi.Sendpulse;
public class Example {
	// https://login.sendpulse.com/settings/#api
    private static String userId = "";
    private static String secret = "";
	public static void main(String[] args) { 
		Sendpulse sendpulse = new Sendpulse(userId,secret);
		Map<String, Object> result = (Map<String, Object>) sendpulse.listAddressBooks(1, 0);
		System.out.println("Result: " + result);
	}
}

@@ -16,16 +16,179 @@
 dpulse;%0A
+import java.io.IOException;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Paths;%0Aimport java.util.ArrayList;%0Aimport java.util.Base64;%0Aimport java.util.HashMap;%0A
 import j
@@ -201,16 +201,16 @@
 il.Map;%0A
-
 %0Aimport 
@@ -242,16 +242,17 @@
 dpulse;%0A
+%0A
 public c
@@ -312,20 +312,17 @@
 gs/#api%0A
-    
+%09
 private 
@@ -490,90 +490,1716 @@
 ;%0A%09%09
-Map%3CString, Object%3E result = (Map%3CString, Object%3E) sendpulse.listAddressBooks(1, 0
+//How to attach files%0A%09%09byte%5B%5D bytes = null;%0A%09%09try %7B%0A%09%09%09bytes = Files.readAllBytes(Paths.get(%22example_file_path/example_file_name.pdf%22));%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09// TODO Auto-generated catch block%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09String content = Base64.getEncoder().encodeToString(bytes);%0A%09%09Map%3CString, String%3E attachments = new HashMap%3CString, String%3E();%0A%09%09attachments.put(%22example_file_name.pdf%22, content);%0A%09%09smtpSendMail(sendpulse,%22From Name%22,%22fromemail@example.com%22,%22Recipient Name%22,%22recipient@example.com%22,%22%3Cb%3EHTML BODY%3C/b%3E%22,%22Text body%22,%22Subject%22,attachments);%0A%09%7D%0A%09%0A%09/**%0A%09 * Sending email via SendPulse SMTP%0A%09 * @param sendpulse%0A%09 * @param from_name%0A%09 * @param from_email%0A%09 * @param name_to%0A%09 * @param email_to%0A%09 * @param html%0A%09 * @param text%0A%09 * @param subject%0A%09 * @param attachments%0A%09 */%0A%09public static void smtpSendMail(Sendpulse sendpulse, String from_name, String from_email, String name_to, String email_to, String html,String text, String subject,Map%3CString, String%3E attachments)%7B%0A%09%09Map%3CString, Object%3E from = new HashMap%3CString, Object%3E();%0A%09%09from.put(%22name%22, from_name);%0A%09%09from.put(%22email%22, from_email);%0A%09%09ArrayList%3CMap%3E to = new ArrayList%3CMap%3E();%0A%09%09Map%3CString, Object%3E elementto = new HashMap%3CString, Object%3E();%0A%09%09elementto.put(%22name%22, name_to);%0A%09%09elementto.put(%22email%22, email_to);%0A%09%09to.add(elementto);%0A%09%09Map%3CString, Object%3E emaildata = new HashMap%3CString, Object%3E();%0A%09%09emaildata.put(%22html%22,html);%0A%09%09emaildata.put(%22text%22,text);%0A%09%09emaildata.put(%22subject%22,subject);%0A%09%09emaildata.put(%22from%22,from);%0A%09%09emaildata.put(%22to%22,to);%0A%09%09if(attachments.size()%3E0)%7B%0A%09%09%09emaildata.put(%22attachments_binary%22,attachments);%0A%09%09%7D%0A%09%09Map%3CString, Object%3E result = (Map%3CString, Object%3E) sendpulse.smtpSendMail(emaildata
 );%0A%09
@@ -2225,16 +2225,17 @@
 (%22Result
+s
 : %22 + re
@@ -2244,10 +2244,12 @@
 lt);%0A%09%7D%0A
+%09%0A
 %7D%0A

Add example of Sending email via SendPulse SMTP