For Developers By Developers

You can integrate Mailazy in minutes with your platform. Build and monitor your email solution on a trusted foundation with technical and strategic support when you need it the most.

Configure Order confirmation emails with SMTP for Java

Order confirmation emails is an important component of any email communication strategy. In order to ensure delivery of Order confirmation emails to your customers, reply on a trusted cloud-based email provider like Mailazy as a partner in your growth journey.


You need to complete these given prerequisites, you can skip the step if you have already completed.

  1. Sign up for a Mailazy account.

  2. Complete Domain Authentication.

  3. Generate the Mailazy Access Key

Integrate Mailazy with Java

Start Sending mail using the code provided below:

import java.util.*;
import java.lang.*;
import javax.mail.*;
import javax.mail.internet.*;

class Main {
    public static void main(String[] args) throws MessagingException, UnsupportedEncodingException {
        // Get system properties
        Properties properties = System.getProperties();

        // Setup mail server
        properties.setProperty("", "");
        properties.setProperty("mail.smtp.port", "587"); //TLS Port
        properties.setProperty("mail.smtp.auth", "true"); //enable authentication
        properties.setProperty("mail.smtp.starttls.enable", "true");

        //create Authenticator object to pass in Session.getInstance argument
        Authenticator auth = new Authenticator() {
            //override the getPasswordAuthentication method
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication("ACCESS_KEY", "ACCESS_SECRET");
        Session session = Session.getInstance(properties, auth);

        final Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress("[email protected]", "sender"));
        msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]"));
        msg.setSubject("Hello world!");
        // Unformatted text version
        final MimeBodyPart textPart = new MimeBodyPart();
        textPart.setContent("Hello Bob!", "text/plain; charset=utf-8");
        // HTML version
        final MimeBodyPart htmlPart = new MimeBodyPart();
        htmlPart.setContent("Hello Bob!", "text/html; charset=utf-8");
        // Create the Multipart. Add BodyParts to it.
        final Multipart mp = new MimeMultipart("alternative");


        // Set Multipart as the message's content

        // Send

Send Emails with Mailazy

Mailazy is a simple email service to use, yet it provides so many benefits. Mailazy is the only simple transactional email service you’ll need. And the forever free plan lets you test drive it., Mailazy's team is well-equipped to help you quickly resolve your queries and issues. Try us for free today!

Signup for Free Developer Documentation

Ready to get started?

For High-Volume custom requirements send us an email and we will come up with a detailed quote within 24 hours.

Contact Us