scripting for infopath, sending emails

G

GZ

the form I'm currently working on in infopath has a button that is supposed
to construct an email (onClick event, scripted). the form is basically just a
help desk request, and when the IT department finishes the request, they
click a "job completed" button. this button is supposed to generate an email
and send it back to whoever submitted the help desk request in the first
place (already taken care of). onclick, i'm having trouble with this code,
which i copied from an infopath book. the email service is outlook, and both
outlook and infopath are 2003.

var conf = new ActiveXObject("CDO.Configuration");
conf.Fields.Item("cdoSendUsingMethod") = 1;

this code is nested in a try...catch(e) statement, and when i try to send
the email, the catch statement fires off, saying 'The "SendUser" method
configuration value is invalid' or something very similar, which i am
assuming is the code snippet i provided above. below i added the rest of the
code, just in case. any suggestions?

function CTRL59_6::eek:nClick(eventObj)
{
try
{
var conf = new ActiveXObject("CDO.Configuration");
conf.Fields.Item("cdoSendUsingMethod") = 1;
conf.Fields.Item("cdoSMTPServerName") = "---"; //in reality, there is an
smtp server, i just censored it...
conf.Fields.Item("cdoSMTPConnectionTimeout") = 10;
conf.Fields.Item("cdoSMTPAuthenticate") = 1;
conf.Fields.Item("cdoURLGetLatestVersion") = true;

var cdo = new ActiveXObject("CDO.Message");
cdo.To = XDocument.DOM.selectSingleNode("//my:OpenBy").text;
cdo.From = "IT Department";
cdo.Subject = XDocument.DOM.selectSingleNode("//my:Description").text;
cdo.TextBody = '<a href"' + XDocument.URI + '">Service Survey</a>';

cdo.Send();
}
catch(e)
{
XDocument.UI.Alert(e.description);
}
}
}

thx
GZ
 
H

Henning Krause [MVP - Exhange]

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top