Thanks for the reply - Guess that's what I was really asking - I need to know how to call the ASP.
Main Topics
Browse All TopicsTrying 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
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
Dim strResult, numResultCode
numResultCode = objSmtpMail.SimpleSendScri
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
If error.num <> 0 Then
Set objOutlook = CreateObject("Outlook.Appl
error.clear
End If
Set NS = objOutlook.GetNamespace("M
NS.Logon
Set objOutlookMsg = objOutlook.CreateItem(0)
vTo = document.ticketemail.toLin
vCC = document.ticketemail.toCCL
vBody = document.ticketemail.toBod
vSubject = document.ticketemail.toSub
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
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Save this as testEmail.asp:
**************************
<%
IF request("senMail") = 1 THEN
SMTP.ServerAddr = "" 'email server
SMTP.FromAddr = Request("emailadd") 'sender email address
SMTP.AddRecipient "You", "you@you.com", 0 'add an email recipient
SMTP.BodyFormat = 1 'html format
SMTP.Subject = Request("subject") 'email subject
SMTP.BodyText ="<html>NAME: " & Request("name") & "<br><br" & Request("desc") & "</html>" 'email body
' USING CDONTS
'Set objMailer = CreateObject("CDONTS.Newma
'objMailer.From = Request("emailadd")
'objMailer.To = "" 'YOUR EMAIL ADDRESS
'objMailer.Subject = Request("subject")
'objMailer.BodyFormat = 0
'objMailer.Mailformat = 0
'objMailer.Body = "NAME: " & Request("name") & "<br><br" & Request("desc")
'objMailer.Send
END IF
%>
<form action="testEmail.asp" method="post">
<b>Send an e-mail:</b><br><br>
Enter your name:<br>
<input type="text" size="40" name="name">
<br><br>
E-mail address:
<br>
<input type="text" size="40" name="emailadd">
<br><br>
Enter Subject:
<br>
<input type="text" size="40" name="subject">
<br><br>
Enter your message:
<br>
<textarea cols="70" rows="15" name="desc"></textarea>
<br><br>
<input type="submit" value="Send Message">
</form>
**************************
Couple small corrections:
**************************
<%
IF request("sendMail") = "1" THEN
SMTP.ServerAddr = "" 'email server
SMTP.FromAddr = Request("emailadd") 'sender email address
SMTP.AddRecipient "You", "you@you.com", 0 'add an email recipient
SMTP.BodyFormat = 1 'html format
SMTP.Subject = Request("subject") 'email subject
SMTP.BodyText ="<html>NAME: " & Request("name") & "<br><br" & Request("desc") & "</html>" 'email body
' USING CDONTS
'Set objMailer = CreateObject("CDONTS.Newma
'objMailer.From = Request("emailadd")
'objMailer.To = "" 'YOUR EMAIL ADDRESS
'objMailer.Subject = Request("subject")
'objMailer.BodyFormat = 0
'objMailer.Mailformat = 0
'objMailer.Body = "NAME: " & Request("name") & "<br><br" & Request("desc")
'objMailer.Send
END IF
%>
<form action="testEmail.asp" method="post">
<b>Send an e-mail:</b><br><br>
Enter your name:<br>
<input type="text" size="40" name="name">
<br><br>
E-mail address:
<br>
<input type="text" size="40" name="emailadd">
<br><br>
Enter Subject:
<br>
<input type="text" size="40" name="subject">
<br><br>
Enter your message:
<br>
<textarea cols="70" rows="15" name="desc"></textarea>
<br><br>
<inpupt type="hidden" name="sendMail" value="1">
<input type="submit" value="Send Message">
</form>
**************************
Business Accounts
Answer for Membership
by: MadhusudanbanikPosted on 2007-10-09 at 03:50:03ID: 20039742
Below is the backend script to send a mail, when the details would be coming from a form on the main webpage. If you want to know how to call the asp then reply back.
)
"))
"))
essage")
onfigurati on")
osoft.com/ cdo/config uration/se ndusing") = 1
osoft.com/ cdo/config uration/sm tpserver") = "http://127.0.0.1" 'IP address of SMTP Server
osoft.com/ cdo/config uration/ sm tpconnecti ontimeout" ) = 10
osoft.com/ cdo/config uration/ sm tpserverpo rt") = 25 ' port on which SMTP works
osoft.com/ cdo/config uration/ sm tpserverpi ckupdirect ory") = "c:\inetpub\mailroot\picku p"
<% if request.form("func1") = "Send Message" then
email = trim(request.form("email")
subject = trim(request.form("subject
message = trim(request.form("message
msg = "Web Form " & chr(10) & chr(10)
msg = msg & "Name : " & name & chr(10)
msg = msg & "Email : " & email & chr(10)
msg = msg & "Message : " & message & chr(10)
Set objMail = Server.CreateObject("CDO.M
Set objConf = Server.CreateObject("CDO.C
Set objFields = objConf.Fields
' SMTP Server Configuration
With objFields
.Item("http://schemas.micr
.Item("http://schemas.micr
.Item("http://schemas.micr
.Item("http://schemas.micr
.Item("http://schemas.micr
.Update
End With
With objMail
Set .Configuration = objConf
.From = email
.To = "xxx@xxx.com" 'Predefined
.Subject = subject 'Predefined
.TextBody = msg
End With
Err.Clear
objMail.Send
response.write "<b>Thank you very much for your post.</b>"
end if
%>