Forum Moderators: open
<%
Dim intCounter, intDecimal, strPassword
For intCounter = 1 To 6
Randomize
intDecimal = Int((26 * Rnd) + 1) + 64
strPassword = strPassword & Chr(intDecimal)
Next
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
server.MapPath("data/hemicustreg.mdb")
connection.Open
sql="INSERT INTO customer ([CmpName], [Address], [City], [State], [Zip], [Number], [Contact], [email], [System], [Pwrd], [Username])"
sql=sql & "VALUES"
sql=sql & "('" & Request.Form("cmpname") & "',"
sql=sql & "'" & Request.Form("address") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("state") & "',"
sql=sql & "'" & Request.Form("zip") & "',"
sql=sql & "'" & Request.Form("number") & "',"
sql=sql & "'" & Request.Form("contact") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("system") & "',"
sql=sql & "'" & strpassword & "',"
sql=sql & "'" & Request.Form("username") & "')"
connection.Execute(sql)
if err<>0 then
Response.Write(Err.Description)
else
response.redirect("tyreg.html")
end if
connection.close
Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.To=Request.Form("email")
Mail.From="lblendowski@magneforcess.com"
Mail.Subject="Just testing my script"
Mail.Body="Your password is" & strPassword
Mail.Send
Set Mail=nothing
%>
If the SMTP server isn't configured correctly, then it may be doing this.
If it's a MS SMTP server you can check in the BadMail, Drop, Queue directories under the MailRoot (defaultly C:\Inetpub\MailRoot).If you find your mail in any of those, then then there's problems with the SMTP server or relay you're using.
ISPs can block traffic from an SMTP server too. I know that lots of Cable Modem companies will block any SMTP relays in their IP blocks to prevent spammers.
Spam engines can block emails that are spoofed. Meaning that if the IP address you're email is coming from isn't the same as the one that the magneforcess.com is authoritative for, a spam engine might see that as spam.
-=casey=-
If it is running and your mail is all in the C:\inetpub\mailroot\badmail folder, then you have other issues. If the server is sending to your mailserver (seperate system) within the company, for example, the firewall will create problems. Firewalls often don't allow traffic to leave and u-turn to come back inside. There are some pretty easy remedies for these kind of situations. If you can't get it working, let us know.
Just got off the line with my web hoster, he thoroughly went through the server my site is sitting on and all is configured correctly. He also said that he knows of several other sites on this server and contacted them and they are not having any problems with email from an asp page. Any other thoughts?
<%
Dim intCounter, intDecimal, strPassword
For intCounter = 1 To 6
Randomize
intDecimal = Int((26 * Rnd) + 1) + 64
strPassword = strPassword & Chr(intDecimal)
Next
Response.Write "Random Password = " & strPassword
Set connection = Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
server.MapPath("data\testing.mdb")
connection.Open
sql="INSERT INTO member (username, email, random)"
sql=sql & "VALUES"
sql=sql & "('" & Request.Form("username") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & strpassword & "')"
response.write(sql)
on error resume next
connection.Execute sql
if err<>0 then
Response.Write(Err.Description)
else
response.write("Record was updated!")
end if
connection.close
Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.to=request.form("email")
Mail.From="lblendowski@magneforcess.com"
Mail.Subject="Just testing my script"
Mail.Body="Your password is" & strPassword
Mail.Send
Set Mail=nothing
%>
</body>
</html>
This is the non-working code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ language="VBScript" %>
<html>
<head>
<title>first asp</title>
<% Response.Buffer = True %>
</head>
<body>
<%
Dim intCounter, intDecimal, strPassword
For intCounter = 1 To 6
Randomize
intDecimal = Int((26 * Rnd) + 1) + 64
strPassword = strPassword & Chr(intDecimal)
Next
set connection=Server.CreateObject("ADODB.Connection")
connection.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &_
server.MapPath("data/hemicustreg.mdb")
connection.Open
sql="INSERT INTO customer ([CmpName], [Address], [City], [State], [Zip], [Number], [Contact], [email], [System], [Pwrd], [Username])"
sql=sql & "VALUES"
sql=sql & "('" & Request.Form("cmpname") & "',"
sql=sql & "'" & Request.Form("address") & "',"
sql=sql & "'" & Request.Form("city") & "',"
sql=sql & "'" & Request.Form("state") & "',"
sql=sql & "'" & Request.Form("zip") & "',"
sql=sql & "'" & Request.Form("number") & "',"
sql=sql & "'" & Request.Form("contact") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("system") & "',"
sql=sql & "'" & strpassword & "',"
sql=sql & "'" & Request.Form("username") & "')"
connection.Execute(sql)
on error resume next
connection.Execute sql
if err<>0 then
Response.Write(Err.Description)
else
response.redirect("tyreg.html")
end if
connection.close
Set Mail=Server.CreateObject("CDONTS.NewMail")
Mail.to=request.form("email")
Mail.From="lblendowski@magneforcess.com"
Mail.Subject="Just testing my script"
Mail.Body="Your password is" & strPassword
Mail.Send
Set Mail=nothing
%>
</body>
</html>
%>