E-mail sending problem.

Discussion in 'Java' started by Serguei.Goumeniouk@cibc.ca, Jul 21, 2005.

  1. Guest

    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();
    , Jul 21, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    55,437
  2. =?Utf-8?B?T3Bh?=

    Sending Mail via System.Net.Mail problem

    =?Utf-8?B?T3Bh?=, Jan 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    3,582
    sachya
    Jan 31, 2006
  3. =?ISO-8859-1?Q?Andr=E9s_Berenguer?=

    Sending e-mail with attachments with the default e-mail client

    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=, Aug 29, 2003, in forum: Java
    Replies:
    0
    Views:
    499
    =?ISO-8859-1?Q?Andr=E9s_Berenguer?=
    Aug 29, 2003
  4. Replies:
    0
    Views:
    1,331
  5. Luke
    Replies:
    2
    Views:
    4,678
    Nigel Wade
    Mar 15, 2007
Loading...

Share This Page