com.xlrit.gears.plugin.mail.MailProperties Maven / Gradle / Ivy
package com.xlrit.gears.plugin.mail;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;
@Data
@Component
@ConfigurationProperties(prefix = "gears.mail")
public class MailProperties {
/** Whether mails will be (attempted to be) sent). */
private boolean enabled = false;
/** The from-address to use if none is set on the mail explicitly. */
private String defaultFromAddress = "[email protected]";
/** An optional replacement address to send mails to, for testing purposes. */
private String overrideToAddress = null;
/** Whether to send mails directly on publish, or on a schedule in batches. */
private Mode mode = Mode.DIRECT;
/** The maximum number of mails to be sent at once. */
private int batchSize = 10;
/** Cron expression indicating how often the mail batch send process will run. */
private String cron = "0 0/10 * * * ?";
public boolean isEnabled(Mode mode) {
return this.enabled && this.mode == mode;
}
enum Mode {
DIRECT, BATCH
}
}