Trying to change existing functionality of a webbased app. Current app sends e-mail via client-side outlook called from VBScript. Want to change to server-side sending of mail.
Current: When send mail button is pressed, here's what happens:
A javascript (.js) file calls a vbscript file with the command: execScript("WriteTicketEma
ilTo()","V
BScript");
Below is the current VBscript file. Would like to replace the VBscript (or add to the Javascript) to utilize server-side SMTP sending. Have downloaded several ActiveX controls. The Javascript and VBScript samples all work fine when I run them stand-alone on the server. When I add the code to the IIS pages, I get automation errors in my client. I assume I need to be using ASP to get things to run server-side, not sure how to call. What/how do I change the execScript command to call the following code vs. the current? - or how do I cut in javascript to get things to run server-side.
Thanks for any advice
<WANTED xxx.asp file>
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<P>
<%
Dim objSmtpMail
Set objSmtpMail = Server.CreateObject("AddEm
ail.SmtpMa
il")
Dim strResult, numResultCode
numResultCode = objSmtpMail.SimpleSendScri
ptable("w"
,"x","y","
z")
If numResultCode = 0 Then
Response.Write "Sent successfully!"
Else
Response.Write "Error " & numResultCode
Response.Write "<BR>" & strResult
End If
%>
</P>
</BODY>
</HTML>
<CURRENT XXX.vbs file contents>1
Sub WriteTicketEmailTo()
dim c, i
Dim vTO, vCC, vBCC, vBody, vSubject
Dim vForm
on error resume next
Set objOutlook = GetObject(,"Outlook.Applic
ation")
If error.num <> 0 Then
Set objOutlook = CreateObject("Outlook.Appl
ication")
error.clear
End If
Set NS = objOutlook.GetNamespace("M
API")
NS.Logon
Set objOutlookMsg = objOutlook.CreateItem(0)
vTo = document.ticketemail.toLin
e.value
vCC = document.ticketemail.toCCL
ine.value
vBody = document.ticketemail.toBod
y.value
vSubject = document.ticketemail.toSub
ject.value
objOutlookMsg.To = vTo
objOutlookMsg.CC = vCC
objOutlookMsg.Body = vBody
objOutlookMsg.Subject = vSubject
objOutlookMsg.Save
objOutlookMsg.Display(true
)
Set ObjOutlook = Nothing
Set ObjOutlookMsg = Nothing
End Sub