/*** * Returns the integer values of the enhanced reply code of the last SMTP reply. * @return The integer values of the enhanced reply code of the last SMTP reply. * First digit is in the first array element. ***/ public int[] getEnhancedReplyCode() { String reply = getReplyString().substring(4); String[] parts = reply.substring(0, reply.indexOf(' ')).split ("\\."); int[] res = new int[parts.length]; for (int i = 0; i < parts.length; i++) { res[i] = Integer.parseInt (parts[i]); } return res; }
byte[] serverChallenge = Base64.decodeBase64(getReplyString().substring(4).trim());
private void doAddRcpt(String rcpt) throws IOException { boolean success = smtpClient.addRecipient(rcpt); if (!success) { throw new SMTPSendingException(SmtpSendingStep.RCPT, smtpClient.getReplyString()); } } }
public SMTPMessageSender authenticate(String username, String password) throws IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException { if (smtpClient.auth(AuthenticatingSMTPClient.AUTH_METHOD.PLAIN, username, password) == false) { throw new SMTPSendingException(SmtpSendingStep.Authentication, smtpClient.getReplyString()); } return this; }
private void doHelo() throws IOException { int code = smtpClient.helo(senderDomain); if (code != 250) { throw new SMTPSendingException(SmtpSendingStep.Helo, smtpClient.getReplyString()); } }
private void doData(String message) throws IOException { boolean success = smtpClient.sendShortMessageData(message); if (!success) { throw new SMTPSendingException(SmtpSendingStep.Data, smtpClient.getReplyString()); } }
private void doSetSender(String from) throws IOException { boolean success = smtpClient.setSender(from); if (!success) { throw new SMTPSendingException(SmtpSendingStep.Sender, smtpClient.getReplyString()); } }
private void doRCPT(String recipient) throws IOException { int code = smtpClient.rcpt(recipient); if (code != 250) { throw new SMTPSendingException(SmtpSendingStep.RCPT, smtpClient.getReplyString()); } }
writer.close(); if (!client.completePendingCommand()) {// failure throw new IOException("Failure to send the email " + client.getReply() + client.getReplyString()); throw new IOException("Failure to send the email " + client.getReply() + client.getReplyString()); throw new IOException("STARTTLS was not accepted " + client.getReply() + client.getReplyString());