Official Java library ☕ for Pepipost
This library contains methods for easily interacting with the Pepipost Email Sending API to send emails within few seconds.
We are trying to make our libraries Community Driven- which means we need your help in building the right things in proper order we would request you to help us by sharing comments, creating new issues or pull requests.
We welcome any sort of contribution to this library.
The latest 2.5.0 version of this library provides is fully compatible with the latest Pepipost v2.0 API.
For any update of this library check Releases.
- Installation
- Quick Start
- Usage of library in Project
- Sample Example
- Announcements
- Roadmap
- About
- License
- Java version Oracle JDK 7, 8 or OpenJDK 7
- Java Maven Dependencies
- Jackson
- UniRest
- Apache HttpClient
- Java Development Enviromment (IDE).
- A free account on Pepipost. If you don't have a one, click here to signup and get 30,000 emails free every month.
This Java library uses few Maven Dependencies (mentioned above). The reference to these dependencies are added in pom.xml file which will be install automatically. Just need internet access for successful build.
-
Download zip or get a clone for the pepipost repository using
git clone https://github.com/pepipost/pepipost-sdk-java.git
-
In order to open the client library in Eclipse click on
File -> Import
. -
In the import dialog, select
Existing Java Project
and clickNext
. -
Browse to locate the folder containing the source code. Select the detected location of the project and click
Finish
. -
Upon successful import, the project will be automatically built by Eclipse after automatically resolving the dependencies.
-
Starting a new project
-
Click the menu command
File > New > Project
. -
Choose
Maven > Maven Project
. -
Click
Next
. -
Here, make sure to use the current workspace by choosing
Use default Workspace location
, as shown in the picture below. -
Click
Next
. -
Select the quick start project type to create a simple project with an existing class.
-
A
main
method. -
To do this, choose
maven-archetype-quickstart
item from the list. -
Click
Next
. -
In the last step, provide a
Group Id
.andArtifact Id
as shown in the picture below. -
Click
Finish
.
-
-
Add reference of the library project
-
The created Maven project manages its dependencies using its
pom.xml
file. -
In order to add a dependency on the PepipostLib client library, double click on the
pom.xml
file in thePackage Explorer
. -
Opening the
pom.xml
file will render a graphical view on the canvas. -
Here, switch to the
Dependencies
tab. -
Click the
Add
button as shown in the picture below. -
Click the
Add
button will open a dialog where you need to specify Pepipost inGroup Id
and PepipostLib in theArtifact Id
fields. -
Once added click
OK
. -
Save the
pom.xml
file.
-
-
Getting started with code
package testApp.SimpleConsoleApp;
import com.pepipost.api.*;
import com.pepipost.api.models.*;
import com.pepipost.api.controllers.*;
import com.pepipost.api.http.client.*;
import java.util.*;
import java.io.*;
import com.fasterxml.jackson.core.JsonProcessingException;
public class App {
public static void main(String[] args) throws JsonProcessingException {
PepipostClient client = new PepipostClient();
EmailController emailController = client.getEmail();
String apiKey = "my-api-here";
EmailBody body = new EmailBody();
body.setPersonalizations(new LinkedList<Personalizations>());
Personalizations body_personalizations_0 = new Personalizations();
body_personalizations_0.setRecipient("your-rcpt_email@gmail.com");
body.getPersonalizations().add(body_personalizations_0);
body.setTags("tagsjava");
body.setFrom(new From());
body.getFrom().setFromEmail("my-verified-domain@m3m.in");
body.getFrom().setFromName("info");
body.setSubject("JAVA SDK");
body.setContent("Test mail ready to sent");
body.setSettings(new Settings());
body.getSettings().setFooter(0);
body.getSettings().setClicktrack(1);
body.getSettings().setOpentrack(1);
body.getSettings().setUnsubscribe(1);
emailController.createSendEmailAsync(apiKey, body, new APICallBack<SendEmailResponse>() {
public void onSuccess(HttpContext context, SendEmailResponse response) {
// TODO success callback handler
System.out.print("Message :: " + response.getMessage() + "\n" + "Error :: " + response.getErrorInfo().getErrorMessage());
}
public void onFailure(HttpContext context, Throwable error) {
System.out.print(context.getResponse());
}
});
}
}
- Change your api-key and sending domain respectively
- apikey will be available under Login to Pepipost -> Settings -> Integration
- Sending Domain will be available under Login to Pepiost -> Settings -> Sending Domains
*Note :: Domains showing with Active status on Sending Domain dashboard are only allowed to send any sort of emails.* In case there are no Sending Domain added under your account, then first add the domain, get the DNS (SPF/DKIM) settings done and get it reviewed by our compliance team for approval. Once the domain is approved, it will be in ACTIVE status and will be ready to send any sort of emails.
- Run your project
v2.5.0 has been released! Please see the release notes for details.
All updates to this library are documented in our releases. For any queries, feel free to reach out us at dx@pepipost.com
If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback.
pepipost-sdk-java library is guided and supported by the Pepipost Developer Experience Team . This pepipost library is maintained and funded by Pepipost Ltd. The names and logos for pepipost gem are trademarks of Pepipost Ltd.
This code library was semi-automatically generated by APIMATIC v2.0 and licensed under The MIT License (MIT).