use of io.lumeer.core.task.executor.request.SendSmtpEmailRequest in project engine by Lumeer.
the class LumeerBridge method sendEmail.
@SuppressWarnings("unused")
public void sendEmail(final String to, final String fromName, final String subject, final String body, final LinkBridge l, final String attrId, final Value smtpConfig) throws Exception {
if (task.getDaoContextSnapshot().increaseEmailCounter() <= Task.MAX_EMAILS) {
if (StringUtils.isNotEmpty(to) && to.split(",").length > Task.MAX_EMAIL_RECIPIENTS) {
cause = new IllegalStateException("Too many email recipients (more than 100).");
throw cause;
}
final SmtpConfiguration smtpConfiguration = getSmtpConfiguration(smtpConfig);
if (smtpConfiguration != null) {
final SendSmtpEmailRequest sendSmtpEmailRequest = new SendSmtpEmailRequest(subject, to, body, fromName, smtpConfiguration);
registerAttachment(sendSmtpEmailRequest, l, attrId);
operations.add(new SendSmtpEmailOperation(sendSmtpEmailRequest));
}
} else {
cause = new IllegalStateException("Too many requests to send email in a single rule (more than 3).");
throw cause;
}
}
use of io.lumeer.core.task.executor.request.SendSmtpEmailRequest in project engine by Lumeer.
the class LumeerBridge method sendEmail.
@SuppressWarnings("unused")
public void sendEmail(final String to, final String fromName, final String subject, final String body, final DocumentBridge d, final String attrId, final Value smtpConfig) throws Exception {
if (task.getDaoContextSnapshot().increaseEmailCounter() <= Task.MAX_EMAILS) {
if (StringUtils.isNotEmpty(to)) {
if (to.split(",").length > Task.MAX_EMAIL_RECIPIENTS) {
cause = new IllegalStateException("Too many email recipients (more than 100).");
throw cause;
}
final SmtpConfiguration smtpConfiguration = getSmtpConfiguration(smtpConfig);
if (smtpConfiguration != null) {
final SendSmtpEmailRequest sendSmtpEmailRequest = new SendSmtpEmailRequest(subject, to, body, fromName, smtpConfiguration);
registerAttachment(sendSmtpEmailRequest, d, attrId);
operations.add(new SendSmtpEmailOperation(sendSmtpEmailRequest));
}
} else {
cause = new IllegalStateException("Recipients list is empty.");
throw cause;
}
} else {
cause = new IllegalStateException("Too many requests to send email in a single rule (more than 3).");
throw cause;
}
}
use of io.lumeer.core.task.executor.request.SendSmtpEmailRequest in project engine by Lumeer.
the class LumeerBridge method sendEmail.
@SuppressWarnings("unused")
public void sendEmail(final String to, final String fromName, final String subject, final String body, final Value smtpConfig) {
if (task.getDaoContextSnapshot().increaseEmailCounter() <= Task.MAX_EMAILS) {
final SmtpConfiguration smtpConfiguration = getSmtpConfiguration(smtpConfig);
if (smtpConfiguration != null) {
final SendSmtpEmailRequest sendSmtpEmailRequest = new SendSmtpEmailRequest(subject, to, body, fromName, smtpConfiguration);
operations.add(new SendSmtpEmailOperation(sendSmtpEmailRequest));
}
}
}
Aggregations