当前位置: 首页>>代码示例>>Java>>正文


Java RejectException类代码示例

本文整理汇总了Java中org.subethamail.smtp.RejectException的典型用法代码示例。如果您正苦于以下问题:Java RejectException类的具体用法?Java RejectException怎么用?Java RejectException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RejectException类属于org.subethamail.smtp包,在下文中一共展示了RejectException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFallbackConnection

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
/**
 * Gets the current connection to the remote host, or creates one.
 * @throws RejectException if something goes wrong connecting to the backend
 */
SmartClient getFallbackConnection() throws RejectException
{
	if (this.fallbackConnection == null)
	{
		String hostAndPort = SMTPHandler.this.smtpService.getFallbackHost();
		if (hostAndPort != null)
		{
			String[] split = hostAndPort.split(":");
			int port = split.length > 1 ? Integer.parseInt(split[1]) : 25;

			try
			{
				this.fallbackConnection = new SmartClient(split[0], port, this.ctx.getSMTPServer().getHostName());
			}
			catch (IOException e)
			{
				throw new RejectException(554, e.toString());
			}
		}
	}

	return this.fallbackConnection;
}
 
开发者ID:voodoodyne,项目名称:subetha,代码行数:28,代码来源:SMTPHandler.java

示例2: create

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public AuthenticationHandler create()
{
    return new AuthenticationHandler() {
        @Override
        public String auth(String clientInput)
                throws RejectException
        {
            auth.add(clientInput);
            throw new RejectException();
        }

        @Override
        public Object getIdentity()
        {
            throw new AssertionError();
        }
    };
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:20,代码来源:ServerModeHiddenMailConfigIT.java

示例3: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectExceptionExt {
    SPFResult spfResult = spfChecker.getResult();
    String spfResultCode = spfResult.getResult();

    if (spfResultCode.equals(SPFErrorConstants.FAIL_CONV)) {
        String statusText;
        if (spfResult.getExplanation().isEmpty())
            statusText = "Blocked by SPF";
        else
            statusText = "Blocked - see: " + spfResult.getExplanation();
        throw new RejectException(550, statusText);
    } else if (spfResult.equals(SPFErrorConstants.TEMP_ERROR_CONV)) {
        throw new RejectException(451,
                "Temporarily rejected: Problem on SPF lookup");
    } else if (rejectOnPermanentError
            && spfResultCode.equals(SPFErrorConstants.PERM_ERROR_CONV)) {
        throw new RejectException(550, "Blocked - invalid SPF record");
    }

    return chain.verifyRecipient(recipientContext);
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:24,代码来源:RejectOnFailedSpfCheck.java

示例4: deliver

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
public void deliver(InputStream data) throws RejectException, TooMuchDataException, IOException
{
	this.client.dataStart();

	byte[] buffer = new byte[8192];
	int numRead;
	while ((numRead = data.read(buffer)) > 0)
		this.client.dataWrite(buffer, numRead);

	this.client.dataEnd();
}
 
开发者ID:voodoodyne,项目名称:subetha,代码行数:12,代码来源:FallbackDeliverer.java

示例5: startSMTP

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
protected void startSMTP(String factory) {
  wiser = new Wiser();

  wiser.setPort(1587);
  wiser.getServer().setAuthenticationHandlerFactory(new AuthenticationHandlerFactory() {
    /*
     * AUTH PLAIN handler which returns success on any string
     */
    @Override
    public List<String> getAuthenticationMechanisms() {
      return Arrays.asList("PLAIN");
    }

    @Override
    public AuthenticationHandler create() {
      return new AuthenticationHandler() {

        @Override
        public String auth(final String clientInput) throws RejectException {
          log.info(clientInput);
          return null;
        }

        @Override
        public Object getIdentity() {
          return "username";
        }
      };
    }
  });

  Security.setProperty("ssl.SocketFactory.provider", factory);
  wiser.getServer().setEnableTLS(true);

  wiser.start();
}
 
开发者ID:vert-x3,项目名称:vertx-mail-client,代码行数:37,代码来源:SMTPTestWiser.java

示例6: convertToReversePath

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
private ReversePath convertToReversePath(String reversePath)
        throws RejectException {
    try {
        return new MailAddressFactory().createReversePath(reversePath);
    } catch (ParseException e) {
        logger.debug("Syntax error in reverse path " + reversePath, e);
        throw new RejectException(553, "Syntax error in reverse path "
                + reversePath);
    }
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:11,代码来源:FilterChainMessageHandler.java

示例7: convertToRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
private Recipient convertToRecipient(String recipient)
        throws RejectException {
    try {
        return new MailAddressFactory().createRecipient(recipient);
    } catch (ParseException e) {
        logger.debug("Syntax error in recipient " + recipient, e);
        throw new RejectException(553, "Syntax error in mailbox name "
                + recipient);
    }
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:11,代码来源:FilterChainMessageHandler.java

示例8: data

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public void data(Mail mail) throws RejectExceptionExt {
    try {
        transmitter.transmit(mail);
    } catch (LocalMailSystemException e) {
        logger.warn("Cannot accept mail because of a "
                + "transmission failure", e);
        throw new RejectException(e.errorStatus().getSmtpReplyCode(), e
                .errorStatus().getMessagePrefixedWithEnhancedStatusCode());
    }
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:12,代码来源:TransmitterDestination.java

示例9: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectException {
    Recipient recipient = recipientContext.recipient;
    if (recipient instanceof GlobalPostmaster)
        return FilterReply.NEUTRAL;
    else if (recipient instanceof RemotePartContainingRecipient)
        return verifyRemotePartContainingRecipient((RemotePartContainingRecipient) recipient);
    else
        throw new IllegalArgumentException();
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:12,代码来源:ProhibitRelaying.java

示例10: verifyRemotePartContainingRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
private FilterReply verifyRemotePartContainingRecipient(
        RemotePartContainingRecipient recipient) throws RejectException {
    RemotePart remotePart = recipient.getMailbox().getRemotePart();
    for (RemotePartSpecification remotePartSpecification : localDomainSpecifications) {
        if (remotePartSpecification.isSatisfiedBy(remotePart))
            return FilterReply.NEUTRAL;
    }
    throw new RejectException(550,
            "Relaying prohibited, user is not local (" + recipient + ")");

}
 
开发者ID:hontvari,项目名称:mireka,代码行数:12,代码来源:ProhibitRelaying.java

示例11: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectException {
    if (recipientSpecification.isSatisfiedBy(recipientContext.recipient))
        return FilterReply.ACCEPT;
    else
        return FilterReply.NEUTRAL;
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:9,代码来源:AcceptRecipient.java

示例12: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectException {
    if (recipientContext.recipient.isPostmaster())
        return FilterReply.ACCEPT;
    else
        return FilterReply.NEUTRAL;
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:9,代码来源:AcceptPostmaster.java

示例13: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectException {
    if (recipientContext.recipient.isGlobalPostmaster())
        return FilterReply.ACCEPT;
    else
        return FilterReply.NEUTRAL;
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:9,代码来源:AcceptGlobalPostmaster.java

示例14: verifyRecipient

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
@Override
public FilterReply verifyRecipient(RecipientContext recipientContext)
        throws RejectException {
    if (recipientContext.recipient.isDomainPostmaster())
        return FilterReply.ACCEPT;
    return FilterReply.NEUTRAL;
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:8,代码来源:AcceptDomainPostmaster.java

示例15: sendDataStream

import org.subethamail.smtp.RejectException; //导入依赖的package包/类
private void sendDataStream(InputStream data) throws IOException,
        RejectException {
    byte[] buffer = new byte[8192];
    int numRead;
    while ((numRead = data.read(buffer)) > 0) {
        try {
            smartClient.dataWrite(buffer, numRead);
        } catch (IOException e) {
            throw new RejectException(451, e.getMessage());
        }
    }
}
 
开发者ID:hontvari,项目名称:mireka,代码行数:13,代码来源:ClientWithProxyErrorHandling.java


注:本文中的org.subethamail.smtp.RejectException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。