use of com.helger.smtp.settings.ISMTPSettings in project phoss-directory by phax.
the class AppInternalErrorHandler method doSetup.
public static void doSetup() {
// Set global internal error handlers
new AppInternalErrorHandler().install();
final NamedSMTPSettings aNamedSettings = PhotonCoreManager.getSMTPSettingsMgr().getSettings(CNamedSMTPSettings.NAMED_SMTP_SETTINGS_DEFAULT_ID);
final ISMTPSettings aSMTPSettings = aNamedSettings == null ? null : aNamedSettings.getSMTPSettings();
InternalErrorSettings.setSMTPSenderAddress(new EmailAddress("pd@helger.com", CPDPublisher.getApplicationTitle()));
InternalErrorSettings.setSMTPReceiverAddress(new EmailAddress("philip@helger.com", "Philip"));
InternalErrorSettings.setSMTPSettings(aSMTPSettings);
InternalErrorSettings.setFallbackLocale(AppCommonUI.DEFAULT_LOCALE);
}
use of com.helger.smtp.settings.ISMTPSettings in project ph-web by phax.
the class FailedMailDataTest method testWithData.
@Test
public void testWithData() {
final ISMTPSettings aSettings = _createSMTPSettings();
final EmailData aData = _createEmailData();
final FailedMailData aFMD = new FailedMailData(aSettings, aData);
assertNotNull(aFMD.getID());
assertNotNull(aFMD.getErrorDateTime());
assertEquals(aSettings, aFMD.getSMTPSettings());
assertEquals(aData.getSentDateTime(), aFMD.getOriginalSentDateTime());
assertEquals(aData, aFMD.getEmailData());
assertFalse(aFMD.hasTransportError());
assertNull(aFMD.getTransportThrowableMessage());
assertNull(aFMD.getTransportError());
XMLTestHelper.testMicroTypeConversion(aFMD);
}
use of com.helger.smtp.settings.ISMTPSettings in project ph-web by phax.
the class MailQueuePerSMTP method stopQueuingNewObjects.
/**
* Stop this queue
*
* @param bStopImmediately
* <code>true</code> if all mails currently in the queue should be
* removed and put in the failed mail queue. Only the emails currently
* in sending are continued to be sent out.
* @return {@link ESuccess}
*/
@Nonnull
public ESuccess stopQueuingNewObjects(final boolean bStopImmediately) {
if (bStopImmediately) {
// Remove all mails from the queue and put it in the failed mail queue
final ICommonsList<Object> aLeftOvers = new CommonsArrayList<>();
m_aQueue.drainTo(aLeftOvers);
if (!aLeftOvers.isEmpty()) {
final ISMTPSettings aSMTPSettings = getSMTPSettings();
for (final Object aLeftOver : aLeftOvers) m_aFailedMailQueue.add(new FailedMailData(aSMTPSettings, (IMutableEmailData) aLeftOver));
if (LOGGER.isInfoEnabled())
LOGGER.info("Put " + aLeftOvers + " unsent mails into the failed mail queue because of immediate stop.");
}
}
// Regular stop
return super.stopQueuingNewObjects();
}
Aggregations