protected String getDeliveryStatusNotification()

in geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/smtp/SMTPTransport.java [427:487]


    protected String getDeliveryStatusNotification(Message message) {
        String dsn = null;

        // there's an optional notification argument that can be added to
        // MAIL TO. See if we've been
        // provided with one.

        // an SMTPMessage object is the first source
        if (message instanceof SMTPMessage) {
            // get the notification options
            int options = ((SMTPMessage) message).getNotifyOptions();

            switch (options) {
            // a zero value indicates nothing is set.
            case 0:
                break;

            case SMTPMessage.NOTIFY_NEVER:
                dsn = "NEVER";
                break;

            case SMTPMessage.NOTIFY_SUCCESS:
                dsn = "SUCCESS";
                break;

            case SMTPMessage.NOTIFY_FAILURE:
                dsn = "FAILURE";
                break;

            case SMTPMessage.NOTIFY_DELAY:
                dsn = "DELAY";
                break;

            // now for combinations...there are few enough combinations here
            // that we can just handle this in the switch statement rather
            // than have to
            // concatentate everything together.
            case (SMTPMessage.NOTIFY_SUCCESS + SMTPMessage.NOTIFY_FAILURE):
                dsn = "SUCCESS,FAILURE";
                break;

            case (SMTPMessage.NOTIFY_SUCCESS + SMTPMessage.NOTIFY_DELAY):
                dsn = "SUCCESS,DELAY";
                break;

            case (SMTPMessage.NOTIFY_FAILURE + SMTPMessage.NOTIFY_DELAY):
                dsn = "FAILURE,DELAY";
                break;

            case (SMTPMessage.NOTIFY_SUCCESS + SMTPMessage.NOTIFY_FAILURE + SMTPMessage.NOTIFY_DELAY):
                dsn = "SUCCESS,FAILURE,DELAY";
                break;
            }
        }

        // if still null, grab a property value (yada, yada, yada...)
        if (dsn == null) {
            dsn = props.getProperty(MAIL_SMTP_DSN_NOTIFY);
        }
        return dsn; 
    }