Class SMTPMailConnector

  • All Implemented Interfaces:
    eu.tsystems.mms.tic.testframework.logging.Loggable

    public class SMTPMailConnector
    extends AbstractMailConnector
    implements eu.tsystems.mms.tic.testframework.logging.Loggable
    MailConnector using the SMTP Protocol. Creates a session with values from mailconnection.properties.
    • Constructor Detail

      • SMTPMailConnector

        public SMTPMailConnector()
        Constructor, creates a SMTPMailConnector Object.
    • Method Detail

      • sendMessage

        public void sendMessage​(jakarta.mail.internet.MimeMessage message)
                         throws eu.tsystems.mms.tic.testframework.exceptions.SystemException
        Send a new message.
        Parameters:
        message - The message to send.
        Throws:
        eu.tsystems.mms.tic.testframework.exceptions.SystemException - thrown if message was not sent.
      • createAttachment

        public jakarta.mail.internet.MimeBodyPart createAttachment​(java.io.File file)
        Creates a MimeBodyPart attachment from file.
        Parameters:
        file - The file to convert to MimeBodyPart.
        Returns:
        MimeBodyPart.
      • addAttachmentsToMessage

        public jakarta.mail.internet.MimeMessage addAttachmentsToMessage​(jakarta.mail.internet.MimeBodyPart[] attachments,
                                                                         jakarta.mail.Message message)
        Add MimeBodyParts to a message. Can only called once, otherwise message text can not saved.
        Parameters:
        attachments - An array containing the MimeBodyParts.
        message - The message to add the attachments.
        Returns:
        The message with the attached MimeBodyParts.
      • generateVirusMail

        public jakarta.mail.internet.MimeMessage generateVirusMail​(java.lang.String from,
                                                                   java.lang.String receiver,
                                                                   java.lang.String ccReceiver,
                                                                   java.lang.String bcc)
                                                            throws eu.tsystems.mms.tic.testframework.exceptions.SystemException,
                                                                   java.lang.RuntimeException
        Send a virus mail.
        Parameters:
        from - The from address.
        receiver - The to address.
        ccReceiver - The cc address. Can be null.
        bcc - The bcc address. Can be null.
        Returns:
        A MimeMessage containing a virus signature.
        Throws:
        eu.tsystems.mms.tic.testframework.exceptions.SystemException - thrown if virus Mail can't generated.
        java.lang.RuntimeException - thrown if address parameters were wrong.
      • getMessageID

        public java.lang.String getMessageID()
        .
        Returns:
        .
      • getLastSentMessage

        public jakarta.mail.internet.MimeMessage getLastSentMessage()
        .
        Returns:
        last sent message
      • setMessageID

        public void setMessageID​(java.lang.String messageID)
        sets the messageID
        Parameters:
        messageID - the messageID to set
      • setLastSentMessage

        public void setLastSentMessage​(jakarta.mail.internet.MimeMessage lastSentMessage)
        sets the last sent message
        Parameters:
        lastSentMessage - the lastSentMessage to set