Say I have 10 emails to send outbound to an SMTP server.
1) Do I use a for loop and send each mail one at a time
2) Do I create a bundle, add the 10 emails to that bundle using a loop and then send the bundle
Which is better in terms of performance?
#2 is better because it happens in a single SMTP session. However, the behavior of SMTP servers vary with respect to errors. I’ll explain: Some SMTP servers do MX lookups to try to validate email addresses. Others do not. For the SMTP servers that validate, if an error occurs some will abort the entire transaction (i.e. no emails will be sent) whereas others will not. The behavior of Chilkat is to continue sending the remainder of emails in the bundle even when errors occur. Of course, if the SMTP server forcibly closes the session/connection, the emails will not be sent. It is impossible (for Chilkat) to know whether some or none of the emails were sent because each SMTP server may behave differently. My advice is to sanity-check your recipient email addresses in each bundle and to send in smaller chunks. You might also test to see how your SMTP server behaves with invalid email addresses — does the entire bundle not get sent? You can then code appropriately for it.