---
title: "Send email from Spring Boot over SMTP"
description: "JavaMailSender properties pointed at Unitpost."
url: https://www.unitpost.com/guides/smtp/spring
section: SMTP
updated: 2026-08-28
---
# Send email from Spring Boot over SMTP

## Connection settings

- **Host**: smtp.unitpost.com
- **Username**: unitpost (always this literal value)
- **Password**: Your Unitpost API key (must carry emails:send)
- **Port (STARTTLS)**: 587 (or 2587 if blocked)
- **Port (implicit TLS)**: 465 (or 2465 if blocked)
- **From address**: Any address on a verified domain

## Send email from Spring Boot over SMTP

> JavaMailSender properties pointed at Unitpost.

Set Spring Mail properties to Unitpost SMTP and send with JavaMailSender. Port 587, STARTTLS, username `unitpost`.

### 1. Set mail properties

```properties
spring.mail.host=smtp.unitpost.com
spring.mail.port=587
spring.mail.username=unitpost
spring.mail.password=${UNITPOST_API_KEY}
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
```

### 2. Send with JavaMailSender

```java
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true);
helper.setFrom("you@yourdomain.com");
helper.setTo("customer@example.com");
helper.setSubject("Hello from Spring");
helper.setText("<p>Sent via SMTP.</p>", true);
mailSender.send(message);
```

### 3. Verify delivery

Check Activity.

## Related

- [Send email from .NET over SMTP](https://www.unitpost.com/guides/smtp/dotnet): MailKit pointed at Unitpost.
- [Send email with Nodemailer over SMTP](https://www.unitpost.com/guides/smtp/nodemailer): createTransport pointed at Unitpost — Node, Next.js, or NestJS.
- [Send Supabase auth email over SMTP](https://www.unitpost.com/guides/smtp/supabase): Magic links and confirmations from your verified domain.
