openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solo...@apache.org
Subject svn commit: r1451533 - /openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
Date Fri, 01 Mar 2013 08:59:42 GMT
Author: solomax
Date: Fri Mar  1 08:59:41 2013
New Revision: 1451533

URL: http://svn.apache.org/r1451533
Log:
[OPENMEETINGS-327] mailQ configDao is queued fewer times

Modified:
    openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java

Modified: openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
URL: http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java?rev=1451533&r1=1451532&r2=1451533&view=diff
==============================================================================
--- openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
(original)
+++ openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/utils/mail/MailHandler.java
Fri Mar  1 08:59:41 2013
@@ -146,10 +146,10 @@ public class MailHandler {
 		return msg;
 	}
 	
-	private MimeMessage getMimeMessage(MailMessage m) throws Exception {
+	private MimeMessage getMimeMessage(MimeMessage base, MailMessage m) throws Exception {
 		log.debug("getMimeMessage");
 		// Building MimeMessage
-		MimeMessage msg = getBasicMimeMessage();
+		MimeMessage msg = base == null ? getBasicMimeMessage() : new MimeMessage(base);
 		msg.setSubject(m.getSubject());
 		String replyTo = m.getReplyTo();
 		if (replyTo != null && "1".equals(cfgDao.getConfValue("inviter.email.as.replyto",
String.class, "1"))) {
@@ -176,6 +176,10 @@ public class MailHandler {
 	}
 	
 	public void send(final MailMessage m, boolean send) {
+		send(null, m, send);
+	}
+	
+	public void send(final MimeMessage base, final MailMessage m, boolean send) {
 		if (send) {
 			if (m.getId() != 0) {
 				m.setStatus(Status.SENDING);
@@ -189,7 +193,7 @@ public class MailHandler {
 
 					// -- Send the message --
 					try {
-						Transport.send(getMimeMessage(m));
+						Transport.send(getMimeMessage(base, m));
 						m.setStatus(Status.DONE);
 					} catch (Exception e) {
 						log.error("Error while sending message", e);
@@ -214,11 +218,12 @@ public class MailHandler {
 		log.debug("... resetSendingStatus done.");
 	}
 	
-	public void sendMails() {
+	public void sendMails() throws Exception {
+		MimeMessage base = getBasicMimeMessage();
 		log.debug("sendMails enter ...");
 		List<MailMessage> list = mailMessageDao.get(0, 1);
 		while (!list.isEmpty()) {
-			send(list.get(0), true);
+			send(base, list.get(0), true);
 			list = mailMessageDao.get(0, 1);
 		}
 		log.debug("... sendMails done.");



Mime
View raw message