(ERJavaMail.sharedInstance ().defaultXMailerHeader () != null))
(ERJavaMail.sharedInstance ().defaultXMailerHeader () != null)) {
    protected void finishMessagePreparation () throws MessagingException {        DataHandler messageDataHandler = messageDataHandler = this.prepareMail ();        // Add all the attachements to the javamail message        if (this.attachments ().count () > 0) {            // Create a Multipart that will hold the prepared multipart and the attachments            MimeMultipart multipart = new MimeMultipart ();            // Create the main body part            BodyPart mainBodyPart = new MimeBodyPart ();            mainBodyPart.setDataHandler (messageDataHandler);            // add the main body part to the content of the message            multipart.addBodyPart (mainBodyPart);            // add each attachments to the former multipart            Enumeration en = this.attachments ().objectEnumerator ();            while (en.hasMoreElements ()) {                ERMailAttachment attachment = (ERMailAttachment)en.nextElement ();                BodyPart bp = attachment.getBodyPart ();                bp.setDisposition (Part.ATTACHMENT);                multipart.addBodyPart (bp);            }            this.mimeMessage ().setContent (multipart);        } else {            this.mimeMessage ().setDataHandler (messageDataHandler);        }        // If the xMailer property has not been set, check if one has been provided        // in the System properties        if ((this.xMailerHeader () == null) &&            (ERJavaMail.sharedInstance ().defaultXMailerHeader () != null))            this.setXMailerHeader (ERJavaMail.sharedInstance ().defaultXMailerHeader ());        this.mimeMessage ().setSentDate (new Date ());        this.mimeMessage ().saveChanges ();    }