Chad,

Just extend Authenticator.


package com.jasusa.mail;

import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;

public class EmailAuthenticator extends Authenticator {
        private String password;
        private String username;
        public EmailAuthenticator() {
                this.username = new String("");
            this.password = new String("");
        }
        public EmailAuthenticator(String username, String password) {
                this.username = username;
                this.password = password;
        }
        public String getPassword() {
                return password;
        }
        public PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(this.username,
this.password);
        }
        public String getUsername() {
                return username;
        }
        public void setPassword(String password) {
                this.password = password;
        }
        public void setUsername(String username) {
                this.username = username;
        }




------------------------------

message: 2
date: Tue, 6 Sep 2005 07:45:31 -0600 
from: "cornelius, chad" <chad.cornelius@xxxxxxxxxxxxxxxxxxxx>
subject: RE: JavaMail and 550 Relay issues 

Tony,

Thanks for the information...  The Session.getInstance only receives
parameters of type Property and Authenticator.  How were you able to pass
the PasswordAuthentication object?

Thanks,
Chad Cornelius, IIS
(720) 921-7835

-----Original Message-----
From: Tony Richardson - JASUSA/CORP [mailto:trichardson@xxxxxxxxxx] 
Sent: Tuesday, September 06, 2005 4:05 AM
To: java400-l@xxxxxxxxxxxx
Subject: JavaMail and 550 Relay issues 

Chad,

Have you tried javax.mail.PasswordAuthentication class? I use it to relay
mail through our mail server.


PasswordAuthentication authenticator = new
PasswordAuthentication(Email.USERNAME, Email.PASSWORD);
Session session = Session.getInstance(props, authenticator);
Transport transport = session.getTransport("smtp");
transport.connect(Email.HOST, Email.USERNAME, Email.PASSWORD);
transport.sendMessage(msg, addresses);


Tony

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of java400-l-request@xxxxxxxxxxxx
Sent: Saturday, September 03, 2005 1:00 PM
To: java400-l@xxxxxxxxxxxx
Subject: JAVA400-L Digest, Vol 3, Issue 313

Send JAVA400-L mailing list submissions to
        java400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.midrange.com/mailman/listinfo/java400-l
or, via email, send a message with subject or body 'help' to
        java400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
        java400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of JAVA400-L digest..."


Today's Topics:

   1. JavaMail and 550 Relay issues (cornelius, chad)
   2. Re: JavaMail and 550 Relay issues (David Gibbs)


----------------------------------------------------------------------

message: 1
date: Fri, 2 Sep 2005 14:35:43 -0600 
from: "cornelius, chad" <chad.cornelius@xxxxxxxxxxxxxxxxxxxx>
subject: JavaMail and 550 Relay issues

I realize that if our exchange server does not allow relaying we are unable
to send emails to outside agencies.  Does anyone know a way to get around
this?  We tried creating an internet mail account on our exchange server,
but that still does not work.  Any ideas?

 

Thanks,

Chad Cornelius, IIS

(720) 921-7835



------------------------------


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.