Agilent Technologies

Send Email with Attachments Read Me

AGILENT PROVIDES THIS FREE SOFTWARE "AS IS". ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO ANY WARRANTY OF NON-INFRINGEMENT, THE IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY, REASONABLE CARE AND SKILL, AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Agilent shall not be liable in any way whatsoever for any damages of any nature arising from its use. In no event shall Agilent be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to: procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability or tort (including negligence or otherwise) except if caused by willful misconduct or gross negligence arising in any way out of the use of this software, even if advised of the possibility of such damage and if it has been ensured that such data can be reconstructed with reasonable expenditure from data material provided in machine-readable form.

Date: April 20, 2004

Version: 1.0

Language: Agilent VEE Pro 7.0 (not compatible with earlier revisions)

Instruments: Not applicable

OS Requirements: Microsoft® Windows® 98, NT 4.0, ME, 2000, or XP

To install this example, download contrib_vee_email_attach_may_04.exe anywhere handy and double-click to extract email_with_attachments.vee and readme.txt.

To use this example, either double-click email_with_attachments.vee or start VEE Pro 7.0 (or later) and Open it from the File menu.

Before you run it:

Now you can press the Run button, which will send the email, including the attachments.

This example differs from the Send Mail example in the System menu and the SendMail.vee example in the examples\DotNET\ directory in that it demonstrates how to add attachments to an email. 

Because of this, it uses a different "signature" for the System.Web.Mail.SmtpMail.Send() method. The other examples use a signature that accepts 4 Text parameters: to, from , subject, and body (the message text). It doesn't require a System.Web.Mail.MailMessage object, discussed below, but that limits its flexibility and usefulness.

This example uses a signature for the Send() method that accepts a System.Web.Mail.MailMessage, to which we can add System.Web.Mail.MailAttachment objects. So we require some extra steps to build and initialize the MailMessage, and to build and add to it the System.Web.Mail.MailAttachment objects.

Error-handling in the example is non-existent for simplicity. This is not recommended practice.

Windows is a U.S. registered trademark of Microsoft Corporation

Microsoft is a U.S. registered trademark of Microsoft Corporation

Copyright © 2004 Agilent Technologies, Inc.


© Agilent 2000-2006