Package com.nilhcem.fakesmtp.server
Class MailListener
java.lang.Object
com.nilhcem.fakesmtp.server.MailListener
- All Implemented Interfaces:
org.subethamail.smtp.helper.SimpleMessageListener
public final class MailListener
extends Object
implements org.subethamail.smtp.helper.SimpleMessageListener
Listens to incoming emails and redirects them to the
MailSaver
object.- Since:
- 1.0
- Author:
- Nilhcem
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MailListener
Creates the listener.- Parameters:
saver
- aMailServer
object used to save emails and notify components.
-
-
Method Details
-
accept
Accepts all kind of email (always return true).Called once for every RCPT TO during a SMTP exchange.
Each accepted recipient will result in a separate deliver() call later.- Specified by:
accept
in interfaceorg.subethamail.smtp.helper.SimpleMessageListener
- Parameters:
from
- the user who send the email.recipient
- the recipient of the email.- Returns:
- always return
true
-
deliver
Receives emails and forwards them to theMailSaver
object.- Specified by:
deliver
in interfaceorg.subethamail.smtp.helper.SimpleMessageListener
- Throws:
IOException
-