Home » Enterprise Java » spring » Mail


Spring E-Mail Support – GMail SMTP Server Example

This is an example of Spring E-mail support via the Gmail SMTP Server. The Spring Framework provides a utility library for sending emails. The org.springframework.mail package contains all classes that provide the basic email support of the Spring Framework. Here we use its basic interface for sending emails, that is the MailSender interface. We are also making use of the ...

Read More »

Sending e-mails with Spring

We will create a simple Spring service that will be used for sending mail. One method will create a SimpleMailMessage on the spot, while the other will use a preconfigured default message. The source code for the service is the following: package com.javacodegeeks.spring.mail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSender; import org.springframework.mail.SimpleMailMessage; import org.springframework.stereotype.Service; @Service("mailService") public class MailService { @Autowired private MailSender mailSender; ...

Read More »