Mailtraq script within a VBScript

This forum is for discussing Mailtraq's Scripting features. Get help with Mailtraq scripts, templates and external ActiveX scripting.

Mailtraq script within a VBScript

Postby Vince » Fri May 10th, 2013 6:59pm

Is there a way to run a Mailtraq script within a VBScript?

Something like this:

Code: Select all
set comm = CreateObject("ADODB.Command")
comm.ActiveConnection = "dsn=xxx"
comm.CommandText = "xxx"
comm.CommandType = adCmdStoredProc
comm.Parameters.Append comm.CreateParameter ("@Email", adVarChar, adParamInput, 255, From)
Set rs = CreateObject("ADODB.Recordset")
set rs = comm.Execute
If rs("ID") = x then
  MsgSetRcpts(rs("Email"))   <-------------------------- ????????????????????
End IF

I can't find a way to make MsgSetRcpts or any of the other functions listed here to work.

I have been able to run these scripts though

And I can run MsgSetRcpts in a Mailtraq script.

I've tried this:
Code: Select all
Response.SetHeader "To", ""
but it does not change the routing of the message.

The intention is to connect to a database, and make a decision on where to send the message.
Posts: 1
Joined: Fri May 10th, 2013 6:37pm

Re: Mailtraq script within a VBScript

Postby Elric Pedder » Fri May 10th, 2013 9:44pm

Vince wrote:Is there a way to run a Mailtraq script within a VBScript?

Well... it is possible to run a VBScript within Mailtraq and access the ActiveXScripting layer. However the original Mailtraq scripting language described in is an alternative to VBScript and can't be mixed with it.

In the ActiveXScripting environment (e-mail handling mode) you get a few global objects, one is "Request" which is a MailMessage. You can modify the recipients with Request.Recipients. So to set the recipients to and you would use:
Code: Select all
Request.Recipients.CommaText = ",";

Also the constants in the original scripting environment are available with "Server.Ctx", for example
Code: Select all
That appears to be undocumented though.

What you want to accomplish can definitely be done, though. I hope this helps!
Mailtraq Development and Escalation Support
Novitraq Incorporated
User avatar
Elric Pedder
Mailtraq Escalation Support
Posts: 2675
Joined: Tue Nov 23rd, 2004 1:16pm
Location: Montreal, Canada

Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 1 guest