PDA

View Full Version : sending mail on a nt4 server


chris_angell
11-18-2002, 06:20 PM
Hello I have been having a real bad problem trying to mail using a nt4 server, here in my office we have nt5 and I normally use this script.. using CDONTS.NewMail but now I have a problem..

ok below is an example script I usually use, I get hidden values from my form that pass over to this script that send my info, easy, but trying to send mail now .. is making my head go waaaaa

this is the new code I have been trying

<%

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "Advances Support"
Mailer.FromAddress= "support@advances.com"
Mailer.RemoteHost = "127.0.0.1"
Mailer.AddRecipient Request.Form("recipient"), Request.Form("recipient")
Mailer.Subject = "Form Submission"

strMsgHeader = "Form information follows" & vbCrLf

for each qryItem in Request.Form
strMsgInfo = strMsgInfo & qryItem & " - " & request.Form(qryItem) & vbCrLf
next

strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter

if Mailer.SendMail then
Response.Write "Form information submitted..."
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if

%>

this is my old code

<%


Function URLDecode(strToDecode)
strIn = strToDecode
strOut = ""
intPos = Instr(strIn, "+") 'look for + and replace with space
Do While intPos
strLeft = ""
strRight = ""
If intPos > 1 Then strLeft = Left(strIn, intPos - 1)
If intPos < Len(strIn) Then strRight = Mid(strIn, intPos + 1)
strIn = strLeft & " " & strRight
intPos = Instr(strIn, "+") 'and then look for next one
intLoop = intLoop + 1
Loop
intPos = Instr(strIn, "%") 'look for ASCII coded characters
Do While intPos
If intPos > 1 Then strOut = strOut & Left(strIn, intPos - 1)
strOut = strOut & Chr(CInt("&H" & Mid(strIn, intPos + 1, 2)))
If intPos > (Len(strIn) - 3) Then
strIn = ""
Else
strIn = Mid(strIn, intPos + 3)
End If
intPos = Instr(strIn, "%") 'and then look for next one
Loop
URLDecode = strOut & strIn
End Function

function beforeEq(eqStr)
beforeEq = left(eqStr,inStr(eqStr,"=")-1)
end function

function afterEq(eqStr)
afterEq = mid(eqStr,inStr(eqStr,"=")+1)
end function



if request.Form() <> "" Then
fieldStr = request.Form()
Else
fieldStr = request.Querystring()
End If

fieldsArray = split(fieldStr,"&")


for i = 0 to ubound(fieldsArray)
if left(fieldsArray(i),1) <> "_" then
fieldItem = beforeEq(fieldsArray(i))
fieldValue = afterEq(fieldsArray(i))
bodyStr = bodyStr & URLDecode(fieldItem) & ": " & URLDecode(fieldValue) & vbCrLf
End If
next

bodyStr = bodyStr & vbCrLf & vbCrLf
bodyStr = bodyStr & "-------------------------------------------------------------" & vbCrLf


Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = Request("_recipient")
if Request("Email") <> "" Then
ObjMail.From = Request("Email")
Else
ObjMail.From = "anonymous@cisweb.co.uk"
End If
ObjMail.Subject = Request("_subject")
ObjMail.Body = "Below is the result of your feedback form" & vbCrLf &"It was posted on " & date() & vbCrLf & vbCrLf & bodyStr
ObjMail.Send
Set ObjMail = Nothing


if Request("_redirect") <> "" Then
response.redirect Request("_redirect")
Else
response.write "<table width=100% height=98% border=0><tr><td align=center><font face='verdana,arial' size=3>"
response.write "Thank you<p>Your feedback has been sent<p>"
response.write "Click <a href='javascript:history.go(-2)'><b>HERE</b></a> to return to the site."
response.write "</td></tr></table>"
End If
%>

any help, HELLLLLLLLLLLPPPPPP
:)

whammy
11-18-2002, 11:49 PM
First of all, are you sure that component is installed and registered?

If so, I am not familiar with ASPMail, but I did a google search (see my signature!) and found these, maybe they will help:

http://www.dwfaq.com/Tutorials/Forms/asp_form5.asp

http://www.frontserve.com/aspmail.asp

http://support.inetc.net/asp/email/default.htm