本文整理汇总了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;
}
示例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();
}
};
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
示例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();
}
示例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 + ")");
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
}
}