activeX multiple attachment ?

  • How can I get the following to work ?

    It works when sending ONE attachment, but fails if I try to send TWO.

    Function Main()

    Dim iMsg

    set iMsg = CreateObject("CDO.Message")

    Dim objMail

    Set objMail = CreateObject("CDO.Message")

    objMail.From = "test@test.com"

    objMail.To ="test@test.com"

    objMail.Subject="your subject here"

    objMail.Attachment = "c:\1.txt";"c:\2.txt"

    objMail.TextBody = "Thanks"

    objMail.Send

    Set objMail = nothing

    Main = DTSTaskExecResult_Success

    End Function

  • Without looking into it too deeply (only 'cos I havent got the time at the mo') - I think you need to use the attachments collection of the CDO object library to send multiple attachments.

    Set objAttach = collAttachments.Add( [name] [, type] [, source] [, ContentLocation] [, ContentBase] )

    Look into it in msdn under cdo.

    (You can always use an Execute SQL task and the xpsendmail without fannying about with cdo objects.......)

    exec master.dbo.xp_stopmail

    exec master.dbo.xp_startmail

    exec master.dbo.xp_sendmail @recipients = @varRecipients, @copy_recipients = @varCopyTo, @message = @varMessage, @subject = @varSubject, @attachments = @varPath

    Have fun

    Steve

    We need men who can dream of things that never were.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply