problems with javax.mail.Transport

Hi, I' ve got a problem with email client. It connects and gets the messsages correctly but it doesn't send any message. I used javax.mail.Transport and method send(). Here is the code:

javax.mail.Transport transport = session.getTransport("smtp");

Message newMessage = new MimeMessage(session);
newMessage.setFrom(new InternetAddress(dialog.getFrom()));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(dialog.getTo()));
newMessage.setSubject(dialog.getSubject());
newMessage.setSentDate(new Date());
newMessage.setText(dialog.getContent());




//send the message
Transport.send(newMessage);
} catch (Exception e) {
showError("You cannot send the message", false);
}
}

I constantly get this last error. Anyone has any ideas what can be wrong here? All the other things work properly. Thanks in advance for any help.

Comments

  • : Hi, I' ve got a problem with email client. It connects and gets the messsages correctly but it doesn't send any message. I used javax.mail.Transport and method send(). Here is the code:
    :
    : javax.mail.Transport transport = session.getTransport("smtp");
    :
    : Message newMessage = new MimeMessage(session);
    : newMessage.setFrom(new InternetAddress(dialog.getFrom()));
    : newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(dialog.getTo()));
    : newMessage.setSubject(dialog.getSubject());
    : newMessage.setSentDate(new Date());
    : newMessage.setText(dialog.getContent());
    :
    :
    :
    :
    : //send the message
    : Transport.send(newMessage);
    : } catch (Exception e) {
    : showError("You cannot send the message", false);
    : }
    : }
    :
    : I constantly get this last error. Anyone has any ideas what can be wrong here? All the other things work properly. Thanks in advance for any help.
    :


    I shall give a shot at trying to help. Well first off when you mentioned that you could not send any messages but could recieve messages I was thinking to myself (Well, maybe the email service regects the message to be sent because it doesnt have enough information of who the person is. Maybe it thinks its a virus and just regects it). Secondly I was wondering what API you use for Java. I like the one at java.sun.com. Is that part of the code just for sending? Mind posting the full? I'll give it a shot. Also, if i'm not muh help and noone else replies you may try using java.sun.com's forum. When I was playing the the Java API making useless programs I used their very helpful forums

    good luck,

    George

    <------------------------------------------>

    Reach me at:

    AIM IM: kc2keo
    EMAIL: [email protected]

    Pri. Homepage: http://MouyiosMachine.hopto.org:8080

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion