The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Win32::SqlServer::DTS::Task::SendEmail - a subclass of Win32::SqlServer::DTS::Task that represents a DTSSendMailTask object.

SYNOPSIS

    use warnings;
    use strict;
    use Win32::SqlServer::DTS::Application;
    use Test::More;
    use XML::Simple;

    my $xml    = XML::Simple->new();
    my $config = $xml->XMLin('test-config.xml');

    my $app = Win32::SqlServer::DTS::Application->new( $config->{credential} );

    my $package = $app->get_db_package(
        {
            id               => '',
            version_id       => '',
            name             => $config->{package},
            package_password => ''
        }
    );

        my $iterator = $package->get_send_emails();

    while ( my $send_mail = $iterator->() ) {

        print $send_mail->to_string, "\n";

    }

DESCRIPTION

Win32::SqlServer::DTS::Task::SendEmail represents a DTS SendMail task object.

EXPORT

Nothing.

METHODS

All methods from Win32::SqlServer::DTS::Task are also available.

new

Overrides the superclass Win32::SqlServer::DTS::Task method new to define the following attributes:

  • cc_line

  • attachments

  • message_text

  • profile_password

  • profile

  • save_sent

  • is_nt_service

  • subject

  • to_line

is_nt_service

Returns true or false (1 or 0) whether the caller is a Microsoft Windows NT 4.0 or Microsoft Windows 2000 Service. Returns true only if the program that calls the package Execute method is installed as a Windows NT 4.0 or Windows 2000 Service.

save_sent

Returns true or false (1 or 0) whether to save outgoing e-mail messages in the Sent Items folder.

to_string

Overrides superclass Win32::SqlServer::DTS::Task method to_string to return strings for all defined attributes of the object.

get_message_text

Returns a string with the message text defined, including new line characters.

get_cc_line

Returns a string with the email addresses included in the CC field of the email. Email are separated by semicolons.

get_attachments

Returns the complete pathname and filename of the attachments, separated by semicolons.

get_profile_password

Returns a string with the defined profile password, if used.

get_profile

Returns a string with the profile being used to send the email.

get_subject

Returns a string with the subject of the email

get_to_line

Returns a string with all email addresses defined in the To field of the email. Addresses are separated by semicolon characters.

CAVEATS

This class is incomplete. The methods defined for the original SendMailTask class are not defined here, except for those used as get/setter methods.

SEE ALSO

  • Win32::OLE at perldoc.

  • MSDN on Microsoft website and MS SQL Server 2000 Books Online are a reference about using DTS' object hierarchy, but one will need to convert examples written in VBScript to Perl code.

AUTHOR

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Alceu Rodrigues de Freitas Junior

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.