ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Problem passing constructor parms to javamail send method

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem passing constructor parms to javamail send method

    I have this code. Im trying to pass a user id and password from a constructor parm into a method but it's losing scope or something.

    Does anyone see anything

    public RPGMail() { /* default constructor if no server authentication
    }

    public RPGMail(String Name, String pw, String auth) { /constuctor with userid and pasword
    this.userName = Name;
    this.passWord = pw;
    this.smtpAuth = auth;
    }

    System.out.println("user name:" + this.userName);
    System.out.println("pass word:" + this.passWord);
    final String un = this.userName;
    final String pw = this.passWord;
    Session session = Session.getInstance(systemProperty,
    new javax.mail.Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(un, pw);
    }
    }
    );
Working...
X