Joke Collection Website - Public benefit messages - How does javamail send a message to determine whether the message is successful? Will a receipt message be returned? The return value of the send () method is empty.

How does javamail send a message to determine whether the message is successful? Will a receipt message be returned? The return value of the send () method is empty.

Judging by catching exceptions, look at the code I wrote.

Try {

Transport. connect(SMTP, username, password);

transport . sendmessage(message,message . getallrecipients());

transport . close();

out . print(“& lt; Script Character Set =' UTF-8' > Alert ("Mail sent successfully!" ); window . history . go(- 1); & lt/script & gt; ");

} catch (message exception) {

// TODO automatically generated catch block

out . print(“& lt; Script Character Set =' UTF-8' > Alert ("Mail sending failed!" ); window . history . go(- 1); & lt/script & gt; ");

}

In this way, it can be judged whether the transmission is successful or not.

I'm also working on a javamail project recently. Welcome to discuss together.