Geeks With Blogs

Lance's TextBox

If you're using IPWorks for sending email, here are a few things to be aware of:

1.  If you do need to send email with IPWorks, I generally I recommend using the HTMLMailer component for sending email because it has the most comprehensive functionality out of all the IPWorks email components. You can easily add attachments to an outgoing email by using the AddAttachment method. You can easily add an HTML part to your message by setting the MessageHTML property - or you can just send a plain text message simply by setting the MessageText property.

2.  If you tell the component to send a message, and the component is not already connected to the mail server, it will automatically connect, send, and then disconnect.  Why is this important?  Because I see a lot of people mistakenly putting the call to the Send() method in a loop without first calling the Connect() method to connect to the mail.  This of course has the effect of the component reconnecting over and over again!  Bad!

If the component IS already connected to the server when you call the Send method, then it will simply send the message and your connection is kept open. For this reason, be sure to explicitly call the Connect method of the HTMLMailer component to connect to the server prior to entering the send loop if you plan on sending multiple messages consecutively.

3.  Emails could be sent through your own mail server, or you can send each mail directly to the mail server of the recipient. Of course if all of the recipients are served by your own mail server, this choice doesn't apply!

If you choose to send each email directly to the recipients mail server, first discover the server for each of your recipients. You can do this by sending an MX record DNS request for the hostname of the recipient email address (The IPWorks MX component does this for you, or you can use the IPWorks DNS component which supports MX as well as many other DNS record types. The trial installation includes samples for both of these components). Then group outbound recipients by mail server so that if you have multiple recipients being served by the same mail server you can take care of them at the same time. Then when you process your list follow the same advice in #2 above and explicitly connect to each server so that you don't disconnect in between multiple sends to the same server.

Posted on Thursday, October 27, 2005 12:33 PM Programming | Back to top

Comments on this post: Sending email w/ IPWorks

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Lance Robinson | Powered by: