Send Email Using Java

Over THOUSANDS of developers trust SocketLabs to deliver billions 
of emails every month.

SocketLabs is Built for Developers, By Developers

Reach the Inbox with Industry-Leading Deliverability

Integrate with Your Application in Minutes

CUSTOMER TESTIMONIAL

Elections Online

"It’s vital to have reliable email notifications accompany each election or I won’t stay in business. I don’t have the expertise needed to get email to the inbox for all the messages I send, nor do I have the time or even the desire to become such an expert.We selected SocketLabs and have never looked back. Using SocketLabs to handle email delivery relieves me of that burden so my focus can remain where it should be: on developing the most innovative voting system available."

- David Simms, President & Founder Elections Online

Ready to Try SocketLabs?

SocketLabsClient.QuickSend(
	000001, //Your SocketLabs ServerId
	"YOUR-API-KEY", //Your Injection API Key
	"[email protected]", //The To address for your message
	"[email protected]", //The From address for your message
	"Lorem Ipsum", //The Subject line for your message
	"<html>Lorem Ipsum</html>", //The HTML content for your message
	"Lorem Ipsum" //The plaintext content for your message
);

Start Sending In 3 Easy Steps

Integrate and deliver via SMTP or API while benefiting from industry deliverability. 

Create a free developer account to start sending up to 20,000 emails every month.

Sign up for a developer account

{Icon}

Setup your domain

Add the domain you want to send from

{Icon}

Start sending

Send emails from your domain using the API or SMTP. You can also send with your favorite programming language using any of our official or community supported

{Icon}

SocketLabs Loves Developers

No credit card required  •  Sign up in 30 seconds  •  Get access to all features immediately

Get API Key & Server ID
SocketLabs Logo

Headquarters

700 Turner Ind. Way

Suite 100

Aston, Pa 19014 USA

Phone: 1-800-650-1639

International: +1 484-418-1285

Email: Contact Us

Company

Features

Privacy Seal

THOUSANDS of developers trust SocketLabs to deliver billions 
of emails every year.

Simply copy & paste the libraries below into your application to start sending!

See Java Code SamplesTry SocketLabs Free

Get 20K emails/mo to test your API!

Pricing Plans

Starting at only $9.95/month!

Developer questions answered. 

What's an Email API?

The fastest way to start sending email from your app or website without having to build and maintain your own servers.

Email API Definition:

The fastest way to start sending email from your app or website without having to build and maintain your own servers.

Get 20K emails/mo to test your API!

The fastest way to start sending email from your app or website without having to build and maintain your own servers.

Why do I need an Email API?

The fastest way to start sending email from your app or website without having to build and maintain your own servers.

What can I do with your Email APIs?

Email API for Java, ... (list other keywords)

What Email APIs Do You Support?

Explain

Why do I need to integrate my app with an email delivery solution?

Contact Info

 I have more questions about your email API

The SocketLabs Email Delivery Java library allows you to easily send any type of email message supported by our Injection API, from a simple message to a single recipient, to a complex bulk message sent to multiple recipients. 

Quick Send

The QuickSend() method is a static method that allows you to quickly and easily send a message to a single recipient with only one statement!

Sign Up To Try Quick Send
SocketLabsClient client = new SocketLabsClient(000001, "YOUR-API-KEY"); //Your SocketLabs ServerId and Injection API key

BasicMessage message = new BasicMessage();

message.setSubject("Sending A Test Message (Basic Send)");
message.setHtmlBody("<html><body><h1>Sending A Test Message</h1><p>This is the Html Body of my message.</p></body></html>");
message.setPlainTextBody("This is the Plain Text Body of my message.");

message.setFrom(new EmailAddress("[email protected]"));

//A basic message supports up to 50 recipients and supports several different ways to add recipients

// Adding To Recipients
message.getTo().add(new EmailAddress("[email protected]"));
message.getTo().add(new EmailAddress("[email protected]", "Recipient #2"));

// Adding CC Recipients
message.addCcEmailAddress(new EmailAddress("[email protected]",  "Recipient #3" ));

 // Adding Bcc Recipients
message.addBccEmailAddress("[email protected]");
message.addBccEmailAddress("[email protected]", "Recipient #2");

SendResponse response =  client.send(message);
Get API Key & Server ID

Basic Message

A basic message is an email message like you'd send from a personal email client such as Outlook. A basic message can have many recipients, including multiple, To Addresses, CC Addresses, and even BCC Addresses. You can also send a file attachment in a basic message.

Sign Up To Send A Basic Message
SocketLabsClient client = new SocketLabsClient(000001, "YOUR-API-KEY"); //Your SocketLabs ServerId and Injection API key

BulkMessage message = new BulkMessage();

message.setSubject("Sending A Test Message (Bulk Send)");
message.setHtmlBody("<html><body><h1>Sending A Test Message</h1><p>This is the Html Body of my message.</p></body></html>");
message.setPlainTextBody("This is the Plain Text Body of my message.");

message.setFrom(new EmailAddress("[email protected]"));
message.setReplyTo(new EmailAddress("[email protected]"));

message.getTo().add(new BulkRecipient("[email protected]"));
message.getTo().add(new BulkRecipient("[email protected]", "Recipient #2"));
message.getTo().add(new BulkRecipient("[email protected]"));
message.getTo().add(new BulkRecipient("[email protected]", "Recipient #4"));

SendResponse response =  client.send(message);
Get API Key & Server ID

Bulk Message

A bulk message usually contains a single recipient per message and is generally used to send the same content to many recipients, optionally customizing the message via the use of MergeData.

Sign Up To Send A Bulk Message

Home      Developers     Blog       Support      Status      Login     

SocketLabs for developers
Visit GitHub

Scroll down to see our code samples!

To run these samples you will need to obtain an API Key and ServerId number from your SocketLabs Control Panel. 

I don't have a SocketLabs Account

Setup Your Free Account
Obtain Your API Key & ServerID

I have a SocketLabs account

Send Email Using Java

Get Started FreeWhy SocketLabsBlogPricingContact UsSign Up

Home      

Developers     

Blog       

 Status      

Login