diff -ruN dbmail-20030626-kci/mysql/dbmysql.c dbmail-20031006-kci/mysql/dbmysql.c
--- dbmail-20030626-kci/mysql/dbmysql.c	2003-06-27 14:38:45.000000000 -0600
+++ dbmail-20031006-kci/mysql/dbmysql.c	2003-10-06 13:07:10.000000000 -0600
@@ -966,11 +966,13 @@
   int block_count;
   unsigned long *lengths;
   u64_t rowlength;
-  
+#define WRITE_BUFFER_SIZE 2048
+
   trace (TRACE_DEBUG,"db_send_message_lines(): request for [%d] lines",lines);
+  trace (TRACE_DEBUG,"db_send_message_lines(): Using %d size buffer",WRITE_BUFFER_SIZE);
 
   
-  memtst ((buffer=(char *)my_malloc(READ_BLOCK_SIZE*2))==NULL);
+  memtst ((buffer=(char *)my_malloc(WRITE_BUFFER_SIZE*2))==NULL);
 
   snprintf (query, DEF_QUERYSIZE, 
 	    "SELECT * FROM messageblks WHERE message_idnr=%llu ORDER BY messageblk_idnr ASC",
@@ -1002,7 +1004,7 @@
       rowlength = lengths[2];
 		
       /* reset our buffer */
-      memset (buffer, '\0', (READ_BLOCK_SIZE)*2);
+      memset (buffer, '\0', (WRITE_BUFFER_SIZE)*2);
 		
       while ((*nextpos!='\0') && (rowlength>0) && ((lines>0) || (lines==-2) || (block_count==0)))
       {
@@ -1049,7 +1051,7 @@
           nextpos++;
           rowlength--;
 	   
-          if (rowlength%3000==0)  /* purge buffer at every 3000 bytes  */
+          if (rowlength%WRITE_BUFFER_SIZE==0)  /* purge buffer at every WRITE_BUFFER_SIZE bytes  */
           {
               /* fprintf ((FILE *)fstream,"%s",buffer); */
               /* fflush ((FILE *)fstream); */
@@ -1057,7 +1059,7 @@
               fwrite (buffer, sizeof(char), strlen(buffer), (FILE *)fstream);
           
               /*  cleanup the buffer  */
-              memset (buffer, '\0', (READ_BLOCK_SIZE*2));
+              memset (buffer, '\0', (WRITE_BUFFER_SIZE*2));
           }
       }
 
diff -ruN dbmail-20030626-kci/pgsql/dbpgsql.c dbmail-20031006-kci/pgsql/dbpgsql.c
--- dbmail-20030626-kci/pgsql/dbpgsql.c	2003-06-27 14:38:45.000000000 -0600
+++ dbmail-20031006-kci/pgsql/dbpgsql.c	2003-10-06 13:01:31.000000000 -0600
@@ -894,11 +894,13 @@
   char *nextpos, *tmppos = NULL;
   int block_count;
   u64_t rowlength;
+#define WRITE_BUFFER_SIZE 2048
 
   trace (TRACE_DEBUG,"db_send_message_lines(): request for [%d] lines",lines);
+  trace (TRACE_DEBUG,"db_send_message_lines(): Using %d size buffer",WRITE_BUFFER_SIZE);
 
 
-  memtst ((buffer=(char *)my_malloc(READ_BLOCK_SIZE*2))==NULL);
+  memtst ((buffer=(char *)my_malloc(WRITE_BUFFER_SIZE*2))==NULL);
 
   snprintf (query, DEF_QUERYSIZE, 
             "SELECT * FROM messageblks WHERE message_idnr=%llu::bigint ORDER BY messageblk_idnr ASC",
@@ -927,7 +929,7 @@
 	  rowlength = PQgetlength(res, PQcounter, 2);
 
 	  /* reset our buffer */
-	  memset (buffer, '\0', (READ_BLOCK_SIZE)*2);
+	  memset (buffer, '\0', (WRITE_BUFFER_SIZE)*2);
 
 	  while ((*nextpos!='\0') && (rowlength>0) && ((lines>0) || (lines==-2) || (block_count==0)))
             {
@@ -974,7 +976,7 @@
 	      nextpos++;
 	      rowlength--;
 
-	      if (rowlength%3000==0)  /* purge buffer at every 3000 bytes  */
+	      if (rowlength%WRITE_BUFFER_SIZE==0)  /* purge buffer at every WRITE_BUFFER_SIZE bytes  */
                 {
 		  /* fprintf ((FILE *)fstream,"%s",buffer); */
 		  /* fflush ((FILE *)fstream); */
@@ -982,7 +984,7 @@
 		  fwrite (buffer, sizeof(char), strlen(buffer), (FILE *)fstream);
 
 		  /*  cleanup the buffer  */
-		  memset (buffer, '\0', (READ_BLOCK_SIZE*2));
+		  memset (buffer, '\0', (WRITE_BUFFER_SIZE*2));
                 }
             }
 
