can anyone post a code for sending mail using Exchange 2003 and
javamial (1.3.2). I am getting authentication error but I know the user
and passoword are correct (i can base64 them and log via telnet ). Is
it just constructing correctly the user name or need to configure the
server ?
here is a snip from a working code with qmail server
props.put("mail.smtp.host", "mail");
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.user", "smtp_cuser");
props.put("mail.smtp.password", "passwd");
props.put("mail.smtp.connectiontimeout", "10000");
Session session = Session.getDefaultInstance(props);
Thanks for responses.
I use exim (and renamed it sendmail) to send mails.
Then again, I use cygwin.
> Thanks for responses.
Put it in debug mode and you'll get a better idea of what is going
wrong.
---
DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
Exception in thread "main" javax.mail.AuthenticationFailedException
at javax.mail.Service.connect(Service.java:264)
at javax.mail.Service.connect(Service.java:134)
at javax.mail.Service.connect(Service.java:86)
at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144)
at javax.mail.Transport.send0(Transport.java:150)
at javax.mail.Transport.send(Transport.java:80)
>
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,
> Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> Exception in thread "main"
> javax.mail.AuthenticationFailedException
> at javax.mail.Service.connect(Service.java:264)
> at javax.mail.Service.connect(Service.java:134)
> at javax.mail.Service.connect(Service.java:86)
> at
> com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144
> ) at javax.mail.Transport.send0(Transport.java:150)
> at javax.mail.Transport.send(Transport.java:80)
Strange. I don't see your program in the stack. Can you post the rest
of your code.
>
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,
> Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> Exception in thread "main"
> javax.mail.AuthenticationFailedException
> at javax.mail.Service.connect(Service.java:264)
> at javax.mail.Service.connect(Service.java:134)
> at javax.mail.Service.connect(Service.java:86)
> at
> com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144
> ) at javax.mail.Transport.send0(Transport.java:150)
> at javax.mail.Transport.send(Transport.java:80)
Strange. I don't see your program in the stack. Can you post the rest
of your code.
>
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,
> Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> Exception in thread "main"
> javax.mail.AuthenticationFailedException
> at javax.mail.Service.connect(Service.java:264)
> at javax.mail.Service.connect(Service.java:134)
> at javax.mail.Service.connect(Service.java:86)
> at
> com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144
> ) at javax.mail.Transport.send0(Transport.java:150)
> at javax.mail.Transport.send(Transport.java:80)
Strange. I don't see your program in the stack. Can you post the rest
of your code.
>
> DEBUG: getProvider() returning
> javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,
> Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth true
> Exception in thread "main"
> javax.mail.AuthenticationFailedException
> at javax.mail.Service.connect(Service.java:264)
> at javax.mail.Service.connect(Service.java:134)
> at javax.mail.Service.connect(Service.java:86)
> at
> com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:144
> ) at javax.mail.Transport.send0(Transport.java:150)
> at javax.mail.Transport.send(Transport.java:80)
Strange. I don't see your program in the stack. Can you post the rest
of your code.