E-mail sending problem.

S

Serguei.Goumeniouk

Dear Experts,
I have an application, which is running at Windows platform and used to
send e-mails through the Microsoft Exchange server. Unfortunately this
server is configured to make a strong client authentication, so I have
to use a user ID and a password in my codes (see below). Without the
lines, marked by (*), I have the error message: "454 5.7.3 Client was
not authenticated".
Is it possible to avoid this authentication procedure, using a simple
fact: both application and e-mail server are running on different
computers, but under the Windows OS?
Regards,
Serguei.

Properties props = new Properties();
props.put("mail.smtp.host", "myhost");
props.put("mail.smtp.auth", "true"); <-- (*)
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(fromAddress));
InternetAddress[] address = {new InternetAddress(toAddress)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setRecipient(Message.RecipientType.CC, new
InternetAddress(ccAddress));
msg.setSubject("JavaMail APIs Test");
msg.setSentDate(new Date());

msg.setText("msgText");
Transport transport = session.getTransport("smtp");
transport.connect(host, "userId", "password"); <-- (*)
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,836
Messages
2,569,748
Members
45,545
Latest member
rapter____0

Latest Threads

Top