| Author |  | 
      
        | HJB Newbie
 
  
 
 Joined: 17 February 2013
 Location: Germany
 Online Status: Offline
 Posts: 4
 | 
          Hi,
           | Posted: 31 October 2014 at 3:01am | IP Logged |   |  
           | 
 |  
 we use a MailBee.SmtpMail.Smtp object to send emails in a loop to for e.g. 1.000 recipients. If the mail has some bigger attachments (tested with 15-30 MBs) we get an OutOfMemoryException when calling 'Send' after for e.g. 37, 185 or 467 mails (depending on the size of the attachments) were successfuilly sent. We call GC.Collect after each mail sent to clean up memroy and we use Message.Reset and Message.Attachments.Clear to re-initialize before preparing and sending the next mail. Any hints on the reason for this and how to avoid OutOfMemoryException in this szenario? Thanks...
 
 Greetings...
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Are you sure you don't have attachments remain in memory somehow? I.e. if you get them into memory with your own code, then add them to MailMessage but they still reside in memory after MailMessage gets cleared as they are independent objects?
           | Posted: 31 October 2014 at 3:09am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | HJB Newbie
 
  
 
 Joined: 17 February 2013
 Location: Germany
 Online Status: Offline
 Posts: 4
 | 
          Hi Alex,
           | Posted: 31 October 2014 at 11:00pm | IP Logged |   |  
           | 
 |  
 i only use pathes/filenames to address files on hard disk, the PDFs or other attachments are NOT loaded into memory at any point.
 
 Greetings...
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          If you're using SubmitToPickupFolder instead of Send, does the problem still occur? You can save to any folder, it's not important that the mails will not actually be sent, it's just for debugging purposes.
           | Posted: 04 November 2014 at 1:48am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |