|
@@ -10,9 +10,8 @@ import bubble.cloud.email.mock.MockMailSender; |
|
|
import bubble.model.account.Account; |
|
|
import bubble.model.account.Account; |
|
|
import bubble.model.account.AccountContact; |
|
|
import bubble.model.account.AccountContact; |
|
|
import bubble.model.account.message.AccountMessage; |
|
|
import bubble.model.account.message.AccountMessage; |
|
|
import bubble.model.cloud.CloudService; |
|
|
|
|
|
|
|
|
import bubble.model.cloud.CloudCredentials; |
|
|
import bubble.server.BubbleConfiguration; |
|
|
import bubble.server.BubbleConfiguration; |
|
|
import com.fasterxml.jackson.databind.JsonNode; |
|
|
|
|
|
import lombok.Getter; |
|
|
import lombok.Getter; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.cobbzilla.mail.sender.SmtpMailSender; |
|
|
import org.cobbzilla.mail.sender.SmtpMailSender; |
|
@@ -49,12 +48,16 @@ public class SmtpEmailDriver extends CloudServiceDriverBase<EmailDriverConfig> i |
|
|
return smtpSender; |
|
|
return smtpSender; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override public void setConfig(JsonNode json, CloudService cloudService) { |
|
|
|
|
|
super.setConfig(json, cloudService); |
|
|
|
|
|
if (!isServiceCompatible()) die("Specified SmtpEmailDriver is not compatible with given config"); |
|
|
|
|
|
|
|
|
@Override public void setCredentials(CloudCredentials credentials) { |
|
|
|
|
|
super.setCredentials(credentials); |
|
|
|
|
|
if (credentials != null && !isServiceCompatible(credentials.getParam(PARAM_HOST))) { |
|
|
|
|
|
die("Specified Smtp Email Driver is not compatible with given config: " + this.getClass().getSimpleName()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
protected boolean isServiceCompatible() { return !SEPARATE_DRIVERS_SMTPS.contains(this.config.getHost()); } |
|
|
|
|
|
|
|
|
protected boolean isServiceCompatible(final String serviceHost) { |
|
|
|
|
|
return !SEPARATE_DRIVERS_SMTPS.contains(serviceHost); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override public boolean send(Account account, AccountMessage message, AccountContact contact) { |
|
|
@Override public boolean send(Account account, AccountMessage message, AccountContact contact) { |
|
|
return EmailServiceDriver.send(this, account, message, contact); |
|
|
return EmailServiceDriver.send(this, account, message, contact); |
|
|