89
Forwarding email in Java
We can forward the received mail to someone else as we send emails. There are many javamail classes that are used to forward the messages to the destination resource.
For better understanding of this example, learn the steps of sending email using JavaMail API first. |
For receiving or sending the email using JavaMail API, you need to load the two jar files:
download these jar files (or) go to the Oracle site to download the latest version. |
Example of forwarding email in Java
As you can see in the above example, we are able to forward the email to the destination resource. Now run this program by :
Load the jar file | c:> set classpath=mail.jar;activation.jar;.; |
compile the source file | c:> javac ForwardMail.java |
run by | c:> java ForwardMail |
Next TopicDeleting Email Using Java Mail Api