This is a code sample of how to use the EMMR Java Emailer Library. The code above is included as a complete NetBeans project here http://sourceforge.net/projects/javaemailer/files/0.1b/sample1%20%28netbeans%20project%29.zip/download I added the code in this topic as an easy way to quickly visualize the code. I will add other code samples in a near futur…
/* * To use the EMMR Java Emailer Library, after creating a new Java application * project, add the JavaMail Library to your project. You can download it from * here : http://www.oracle.com/technetwork/java/index-138643.html * After that, add the EMMR Java Emailer Library (JavaEmailer.jar) to the project. * Now your Java application project is ready to realize mass mailing operations... * See the main function for a simple code creating an Email object and initializing * the SenderEngine to send it to illimited recipients. * Check this url for other samples : * https://sourceforge.net/projects/javaemailer/files/ * Check also the accompagned JavaDoc for more details about how to use * advanced features of the EMMR Java Emailer Library */ package ejelsimple; // Import the ejel package import ejel.*; /** * * @author emmr.rida */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { /* * First, create the Email object that will contain all needed data * to send the email to recipients */ boolean wantDeliveryReceipt = false; Email email = new Email("SenderName", "replyto_address@hostname", wantDeliveryReceipt, "Email subject", "Plain text message", "Html code message"); /* * Create the sender engine object */ int recipientsPerEmail = 1; int senderThreadsCount = 1; SenderEngine engine = new SenderEngine(email, recipientsPerEmail, senderThreadsCount); /* * Add one ore more EmailAccount objects * Param1 : Email account login * Param2 : Email account password * Param3 : Email account SMTP Server address * Param4 : SMTP Server port number * Param5 : Use SSL connection if true * Param6 : SMTP Server needs authentication * Param7 : Frequency of the send operation per hour. 0 for unlimited * Param8 : Set to true to avoid simultanous connections to SMTP Server */ engine.addEmailAccount(new EmailAccount("email_account@hostname", "password", "smtp_address.hostname", 25, false, true, EmailAccount.emailsPerHour_NoLimit, true)); /* * Add recipients to the sender engine */ engine.addRecipients(new Recipient[] { new Recipient("email1@hostname"), new Recipient("email2@hostname"), new Recipient("email3@hostname"), new Recipient("email4@hostname") }); /* * Start the sender engine */ engine.startEngine(); /* * Wait for the engine to terminate the send operation */ while(!engine.isFinished()); /* * Sender engine has finished the mass mailin operation */ } }
Best regards :)
Log in to post a comment.
This is a code sample of how to use the EMMR Java Emailer Library. The code above is included as a complete NetBeans project here http://sourceforge.net/projects/javaemailer/files/0.1b/sample1%20%28netbeans%20project%29.zip/download
I added the code in this topic as an easy way to quickly visualize the code. I will add other code samples in a near futur…
Best regards :)