Test loop runs fine on various 2000 machines but won't run properly on a Win 
2003 server.  Recordset is retrieved and iterated over as the dll is being 
called for each recipient record.

I can do this all day long on Win 2k ... on Win 2003 is only produces a pair of 
files for the very first recipient in the list.  The whole list of users is 
iterated over but the dll only creates two files; one mail file and one control 
file (and the list can be 10's of thousands of recipients).  I've tried this on 
two different Win 2003 servers and get the same result.   Works correclty on 
any Win 2000 machine.

If I use the mode of the dll where I can pass in a sql statement and have it do 
all the merging and file creation for the whole recordset everything seems to 
work ok.

Any know issues w/ Win 2003?

Test loop code is below (problem block is in the OneAtATime conditional):

----------------------------------------

Imports iMSMail
Imports System.Data.SqlClient
Imports System.DateTime
Imports System
Imports System.Text


Public Class Form1
    Inherits System.Windows.Forms.Form


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub 
InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(104, 72)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim mode As String
    Dim strBody As String
    Dim strHTML As String
    Dim messageRoot As String
    Dim statusString As String
    Dim recordCount As Integer
    Dim jobId As String
    Dim startTime As Date
    Dim endTime As Date
    Dim span As TimeSpan
    Dim strConn As String

    Dim email As String
    Dim userName As String
    Dim recipientId As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click


        System.Windows.Forms.MessageBox.Show("This is going to create a ton of 
emails. Make sure your network firewall is blocking SMTP traffic")

        mode = "OneAtATime"
        'mode = "iMSQuery"
        '
        jobId = "8899119988"
        '
        recordCount = 0
        '
        strBody = "Thanks "
        strHTML = ""
        '
        startTime = System.DateTime.Now

        If mode = "iMSQuery" Then

            Dim objMail As New iMSMail.SendMailClass

            objMail.SetHeader("From", """Admin""<[EMAIL PROTECTED]>")

            'objMail.SpoolDir = "c:\\ims\\out\\" '// This is the output 
directory from where IMSPost will trigger mails
            'objMail.SpoolDir = "c:\iMS\out\"
            objMail.SpoolDir = "\\Dionysos\out\"
            objMail.ODBCQueryField = "email"
            objMail.ODBCQuery = "select recipient_id, name, email from 
tbl_lfTestRecipients"
            'objMail.ExODBCQuery = "select recipient_id, name, email from 
tbl_lfTestRecipients_v2"
            objMail.DataSource = "lfTest" '// This is the name of the ODBC 
Datasource name
            objMail.UserName = "sa"         '//Database User name (hyperion)
            objMail.Password = "#$%^&"  '//Database Password
            'objMail.UserName = "cands"     '//Database User name (local vaio 
machine)
            'objMail.Password = "#$%^&"   '//Database Password
            objMail.TokenStart = "<#"
            objMail.TokenEnd = "#>"
            objMail.JOBID = jobId           '// Embedding Job ID to the mail
            objMail.SMTPFROM = "[EMAIL PROTECTED]"
            objMail.SetHeader("To", """<#name#>"" <#smtpto#>")
            objMail.SetHeader("Subject", "Monthly Specials")
            objMail.SetHeader("From", "<[EMAIL PROTECTED]>")
            objMail.Body = "Dear <#name#>\n\nPlease visit www.example.com 
for our monthly specials."
            
objMail.AddAttachment("c:\lF\vb_app\dotNet_version\b_aurora_test.pdf", "")
            objMail.SetHeader("X-Recip", recipientId)
            objMail.SetHeader("XBPS1", jobId)
            objMail.SetHeader("XBPS2", email)

            objMail.SendMail()

            recordCount = objMail.TotalRecipients

            objMail = Nothing

        End If



        If mode = "OneAtATime" Then     ' get the recordset and iterate thru it

            Dim objMail As New iMSMail.SendMailClass

            objMail.SpoolDir = "c:\iMS\out\"
            'objMail.SpoolDir = "\\Dionysos\out\"

            objMail.SetHeader("From", """Admin""<[EMAIL PROTECTED]>")

            ' ###############################################################
            ' #### change these two lines for switching between machines ####
            ' ###############################################################
            ' Hyperion Server
            Dim mySqlConnection As SqlConnection = New 
SqlConnection("server=(local);Trusted_Connection=yes;database=LaunchFax_perfTest;
 user id=sa; password=$#%^&")

            ' Vaio laptop
            'Dim mySqlConnection As SqlConnection = New 
SqlConnection("server=(local);Trusted_Connection=yes;database=CandS_Dev_3_5_06; 
user id=cands; password=#$%^&")

            Dim mySqlDataAdapter As SqlDataAdapter = New SqlDataAdapter("select 
* from tbl_lfTestRecipients_v2", mySqlConnection)

            Dim myDataSet As DataSet = New DataSet

            mySqlDataAdapter.Fill(myDataSet, "tbl_lfTestRecipients_v2")



            ' Create a new dataview instance on the Employees table that was 
just created
            Dim myDataView As DataView = New 
DataView(myDataSet.Tables("tbl_lfTestRecipients_v2"))

            ' Sort the view based on the first column name.
            myDataView.Sort = "recipient_id"

            Dim iReportsTo As Integer
            Dim i As Integer

            For i = 0 To myDataView.Count - 1

                email = myDataView(i)("email")
                userName = myDataView(i)("name")
                recipientId = myDataView(i)("recipient_id")
                '
                objMail.SetHeader("X-Recip", recipientId)
                objMail.SetHeader("XBPS1", jobId)
                objMail.SetHeader("XBPS2", email)
                '
                objMail.SMTPTO = email
                objMail.SetHeader("To", """Bob""<[EMAIL PROTECTED]>")
                objMail.SetHeader("Subject", "Thanks for registering " & Name)
                objMail.Body = "Thanks " & Name & " for all your support"
                objMail.HTML = "<html><body bgcolor=""blue""><font 
face=""arial"" color=""white"">Thanks for joinin' " & Name & 
"</font></body></html>"
                '
                ' send the message
                objMail.SendMail()

                ' increment the total count
                recordCount = recordCount + 1
                '
            Next
            '
            objMail = Nothing
            '
        End If

        endTime = System.DateTime.Now
        span = DateTime.Now.Subtract(startTime)
        messageRoot = "Total time was: "
        statusString = String.Concat(messageRoot, span)
        System.Windows.Forms.MessageBox.Show(statusString)

        messageRoot = "Total record count was: "
        statusString = String.Concat(messageRoot, recordCount)
        System.Windows.Forms.MessageBox.Show(statusString)

    End Sub
End Class



-----------------------------------------

Bob
==^=======================================================
This list server is Powered by iMS  "The Swiss Army Knife of Mail Servers"
--------------------------------------------------------------------------------------
This list is provided as a free service.  Although we will try to address issues
in a timely manner, support via this list is not guaranteed.  If you require 
expedited
support then a support contract is required.  Support may be purchased from
http://www.coolfusion.com/commerce.  Details regarding support options may be 
reviewed
at: http://www.coolfusion.com/SupportOptions.cfm
--------------------------------------------------------------------------------------
To leave this list please complete the form at 
http://www.coolfusion.com/Support/
Need an iMS Developer license?  Sign up for a free license here:
http://www.coolfusion.com/Developers/
List archives: http://www.mail-archive.com/infusion-email%40eoscape.com/
Note: You are subscribed as archive_jab_org / [email protected]
==^=======================================================


Reply via email to