Kinook Software Forums

Kinook Software Forums (
-   [VBP] General Discussion (
-   -   Dynamic Email Attachments (

davidevery 06-03-2003 03:18 AM

Dynamic Email Attachments
Hi all

I am trying to find a way to add files dynamically into the "Attachments" section of a "Send Mail" item.

So far it appears that you have to hard code the path and filename one line at a time, but I would like to use wildcards or some other way to attach files dynamically at build time.

Would appreciate any assistance on this..


kevina 06-03-2003 11:20 AM

re: Dynamic Email Attachments
1 Attachment(s)
Here is a sample (using a Process Files step and a temporary macro) that should achieve what you want. Just replace the file criteria with the files you want to attach, and copy these steps into your build.


pjaquiery 06-03-2003 04:58 PM

A general hint here David, if it is a text field in VBP you can use a macro expansion (macro name inside %%) or script (inside []) to generate its contents. Note too that you can expand macros inside the script, for example to pass parameters to a function call.

This makes VBP extremely powerful as pretty much all option information can be generated at execution time and can come from anywhere.


davidevery 06-03-2003 08:50 PM

Excellent help and support, thanks very much for that, it will solve the problem...

jarrodsinclair 07-25-2003 09:49 PM

Another cool way to send e-mail using CDOSYS objects
here is another way to add attachments and send status of the build when complete:
' send by connecting to port 25 of the SMTP server
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost

Const cdoSendUsingPort = 2
StrSmartHost = "exchange"

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")

Set Flds = iConf.Fields

' set the CDOSYS configuration fields to use port 25 on the SMTP server

With Flds
.Item("") = cdoSendUsingPort
.Item("") = strSmartHost
.Item("") = 10
End With

' build HTML for message body
strHTML = ""
strHTML = strHTML & ""
strHTML = strHTML & ""
strHTML = strHTML & "At %DATETIME%, the build of %ProjectName% (%BUILDNUM%) on %COMPUTERNAME% completed successfully.
strHTML = strHTML & "The Build started at %STARTTIME%.
strHTML = strHTML & ""
strHTML = strHTML & ""

' apply the settings to the message
With iMsg
Set .Configuration = iConf
.To = "%DistributionList%"
.From = ""
.Subject = "Build Succeeded"
.HTMLBody = strHTML
'you and create a loop here and add as many attachment as you would like
.AddAttachment "C:\Program Files\VisBuildPro\VisBuildPro.log"
End With

' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

All times are GMT -5. The time now is 12:52 AM.

Copyright 1999-2019 Kinook Software, Inc.