Author |
|
billymac Newbie
Joined: 29 September 2014 Location: Canada
Online Status: Offline Posts: 5
|
Posted: 19 October 2014 at 6:11pm | IP Logged
|
|
|
I just (mostly) completed converting my mailbee code from sending emails in a loop to using the datatable and mail merge approach.
It is creating the eml files just fine, just needs some tweaking...
But I just thought...
What is the advantage of doing it that way?
Yes, the sending to pickup folder definitely makes sense and I will continue to do that instead of sending each email directly, but after spending a fair bit of time writing the code to create the method to dynamically create the datatable that the mail merge needs, I realized its much easier to just do it the old way which was to read my template file and search and replace the template fields with the values for each email, and then send the email to the pickup folder.
Are there any other advantages of continuing to use the datatable approach that I didn't think of?
The search and replace way is much less code and easier to debug.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 22 October 2014 at 3:40am | IP Logged
|
|
|
Most folks already have database so for them it's easier to process mail merge over their existing db. If you don't have db, you can safely create mails manually.
DB approach may provide some benefits in case when emails are sent to SMTP server rather than to pickup folder due to less memory consumption. I.e. if you add 1000 emails to the queue for effective sending in multi-threaded mode, it will take nearly 1000 times more memory than adding 1 message and db indices (which are just integer numbers). But submitting to a pickup folder is not multi-threaded (multi-threading obviously does not make sense there) and each message is processed separately.
I.e. submitting single messages to the pickup folder 1000 times will take the same time as submitting a batch of 1000 messages there (while sending 1000 individual emails to SMTP will be much slower than sending a batch of 1000 emails with multi-threading and multiple sendings per SMTP session).
Just make sure you never have multiple instances of mail messages in the memory at the same time to keep memory footprint low. As you're processing them one-by-one, this seems to be your case, and things are fine this way.
Regards,
Alex
|
Back to Top |
|
|