All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.ext.mail.MailClient Maven / Gradle / Ivy

/*
 *  Copyright (c) 2011-2015 The original author or authors
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  and Apache License v2.0 which accompanies this distribution.
 *
 *       The Eclipse Public License is available at
 *       http://www.eclipse.org/legal/epl-v10.html
 *
 *       The Apache License v2.0 is available at
 *       http://www.opensource.org/licenses/apache2.0.php
 *
 *  You may elect to redistribute this code under either of these licenses.
 */

package io.vertx.ext.mail;

import io.vertx.codegen.annotations.VertxGen;
import io.vertx.core.*;
import io.vertx.ext.mail.impl.MailClientImpl;

import java.util.UUID;

/**
 * SMTP mail client for Vert.x
 * 

* A simple asynchronous API for sending mails from Vert.x applications * * @author Alexander Lehmann */ @VertxGen public interface MailClient { /** * The name of the default pool */ String DEFAULT_POOL_NAME = "DEFAULT_POOL"; /** * Create a non shared instance of the mail client. * * @param vertx the Vertx instance the operation will be run in * @param config MailConfig configuration to be used for sending mails * @return MailClient instance that can then be used to send multiple mails */ static MailClient create(Vertx vertx, MailConfig config) { return new MailClientImpl(vertx, config, UUID.randomUUID().toString()); } /** * Create a Mail client which shares its connection pool with any other Mail clients created with the same * pool name * * @param vertx the Vert.x instance * @param config the configuration * @param poolName the pool name * @return the client */ static MailClient createShared(Vertx vertx, MailConfig config, String poolName) { return new MailClientImpl(vertx, config, poolName); } /** * Like {@link #createShared(io.vertx.core.Vertx, MailConfig, String)} but with the default pool name * @param vertx the Vert.x instance * @param config the configuration * @return the client */ static MailClient createShared(Vertx vertx, MailConfig config) { return new MailClientImpl(vertx, config, DEFAULT_POOL_NAME); } /** * send a single mail via MailClient * * @param email MailMessage object containing the mail text, from/to, attachments etc * @return a future notified when the operation is finished or it fails * (may be null to ignore the result) */ Future sendMail(MailMessage email); /** * Close the MailClient */ Future close(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy