Warnning! the applets can run in one of the following ways:
The product comes with the applets and the source code for both cases (including servlet).
Running the applets
If you want to test the standalone applets you must provide the following parameters for the applet:
MY_MAIL (the e-mail address you want to send from)
MY_COMPUTER (your computer name or address)
If you want to test the applets and the servlet you must provide the following parameters for the applet:
for example, the file servlet.properties could be: RMailServer.initparams=SERVER=127.0.0.1,COMPUTER=127.0.0.1,USER=user@company.com,DEBUG=Y
Sample applet to send an email:
Sample applet to send this html page:
Programming with RMail
Receiving email 5 lines!
Sample source code to receive email:
pop.connect("pop.mycompany.com","user","pwd"); // Connect
for (int i=1;i<=pop.msgs;i++) { // iterate on number of messages
MailMsg m=pop.retrieveMsg(i); // get message
pop.deleteMsg(i); // delete message// do here whatever you like with the MailMsg object (variable m)
}
pop.disconnect(); // disconnect
Sending an email and attachment 10 lines!
This is a sample source code to send an email:
m=new MailMsg(); // create email
m.from="user1@mycompany.com"; // sender and receiver
m.addRecipient("user2@mycompany.com");
m.subject="test";
part=new MainMsgPart(); // add text part
part.setData("This is the text",MimeEncoder.QUOTED);
part.addPart(part);
m.addFile(new java.io.File("c:\\mydocument.doc")); // add attachment
m.smtpServer="smtp.mycompany.com";
m.mail(); // send mail
Sending alternative parts (Text and HTML)
This is a sample source code to send an email which contains two versions of the text (plain text and html):
m=new MailMsg(); // create email
m.from="user1@mycompany.com"; // sender and receiver
m.addRecipient("user2@mycompany.com");
m.subject="test";
part=new MainMsgPart(); // create alternative
part.ContentType="Multipart";
part.ContentSubType="Alternative";
textpart=new MainMsgPart(); // add text part to the alternative
textpart.setData("This is the text",MimeEncoder.QUOTED);
part.addPart(textpart);
htmlpart=new MainMsgPart(); // add html part to the alternative
htmlpart.ContentType="Text";
htmlpart.ContentSubType="Html";
htmlpart.setData("<html><body>This is the text</body></html>",MimeEncoder.QUOTED);
part.addPart(htmlpart);
m.addPart(part);
m.smtpServer="smtp.mycompany.com";
m.mail(); // send mail