|
|
Lazy Mail™ InstructionsOverviewLazy Mail™ is an ActiveX DLL containing one object, LazyMailer, which has a few simple methods that will allow you to easily send mail from any program capable of using ActiveX DLLs. This includes all of the Visual Studio and Visual Studio .NET products, including Visual Basic 6, Visual Basic .NET, Visual C++, and C#. Why Lazy Mail™ instead of MAPI?If you send email using the MAPI controls provided by Microsoft, the emails will be sent through the default email client on the system (like Outlook, Eudora, etc.). If you've ever done this (I have), you will know that every email you send can trigger a security warning and require the user to click OK twice. There can be configuration issues on your users' computers. In summary, MAPI is not useful for most applications. However, your email client usually communicates with a SMTP server to send email. Lazy Mail™ bypasses MAPI and talks directly to the SMTP server. Purchase InstructionsIf you have not yet purchased Lazy Mail™, you can do so and eliminate the message boxes that pop up by visiting http://www.wsdesigns.com/lazymail. How To Use Lazy Mail™ in 2 Simple StepsYou can view the sample project to see how to use Lazy Mail™ – it should be fairly obvious – and/or read the following directions: 1. Create the LazyMailer objectIn order to send mail using Lazy Mail™, you first create a LazyMailer object, and then call one or more of its methods. The usual way to create the LazyMailer object (in Visual Basic) is to set a project reference to the LazyMail Library (using the Project Menu/References… command), and then write a line of code like this: Dim lazy
As New LazyMailer If you prefer, you can skip setting the reference and "late bind" the LazyMailer object with code like this: Dim
lazy As Object Set
lazy = CreateObject("LazyMail.LazyMailer") The first method is usually better, because it's more efficient and you get automatic dropdown lists of the object's methods and parameter help when you're coding, which is convenient. 2. Send the email·
Basic emailing lazy.sendMessage
"recipient1@aol.com;recipient2@msn.com", _ "sender@returnDomain.com",
"This is the Subject", _ "This
is the body", "mail.optonline.net" Note that for the recipient list, you can supply multiple recipients separated by semicolons. ·
Optional parameters If your outgoing server uses a different port than the standard port 25, or requires logon, you can supply that information with optional additional parameters like this: Example 1 – send a message through a server that listens on port 2220, requiring login and password: lazy.sendMessage
"recipient1@aol.com;recipient2@msn.com", _ "sender@returnDomain.com",
"This is the Subject", _ "This
is the body", "mail.optonline.net", _ 2220,
"myLoginID", "myPassword" Example 2 – BCC and Attachment, using default port, no login or password: In many applications, you will want to present the user with the ability to provide a BCC address. This is because there will otherwise be no record of the email being sent (it will not appear in the user's "Sent Mail" folder in their email client, since Lazy Mail™ bypasses the email client). lazy.sendMessage
"recipient1@aol.com;recipient2@msn.com", _ "sender@returnDomain.com",
"This is the Subject", _ "This
is the body", "mail.optonline.net", _ ,,,"bccAddress@returnDomain.com","C:\myAttach.doc" Important Note: it is up to you to make sure that
the file specified in the attachmentPath parameter exists before calling
sendMessage. Otherwise the email will not be sent, and no error will be
generated. 3.
Advanced Topic: Sending many emails efficiently
If you are sending out a lot of emails in a loop, you can
get greater efficiency by using a single login to the email server for all the
emails. Lazy Mail™ supports this through three methods: OpenSession,
SendEmailViaOpenSession, and CloseSession. Sample ProjectNote: you may reuse the form and code in the sample project freely in your own projects. SupportSend email to lazymailsupport@wsdesigns.com Notice: Lazy Mail™ is a trademark of WS Designs. |