/ Forside / Teknologi / Udvikling / ASP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
ASP
#NavnPoint
smorch 9259
Harlekin 1866
molokyle 1040
Steffanst.. 758
gandalf 657
smilly 564
gibson 560
cumano 530
MouseKeep.. 480
10  Random 410
jmail / newbie
Fra : Mongoose


Dato : 18-05-03 23:44

Hej

har nedenstående script jeg har hentet - men vil gerne have tilføjet jmail -
er der en der kan hjælpe ?
<!--#INCLUDE file="dbase.asp"-->
<!--#INCLUDE file="constants.asp"-->
<%

if request("password") <> request("password2") then
response.redirect "join.asp?lg=pwverify"
end if
email = request("email")
username = request("username")
fullname=request("FirstName") & " " & request("LastName")

Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "select AfUsername from users where AfUsername='"&
request("username")& "'"
sql2 = "select AfUsername from users where email='"& request("email")& "'"
Conn.Open dsn

'check if email exists
rs.open sql2, conn
if not rs.eof then
response.redirect "join.asp?lg=emailtaken&FirstName=" &
request("FirstName") & "&LastName=" & request("LastName") & "&email=" &
request("email") & "&city=" & request("city") & "&address=" &
request("address") & "&zip=" & request("zip")
end if
rs.close

rs.open sql, conn
if rs.eof then

sql1 = "INSERT INTO users(FirstName, LastName, EMail, AfUsername, Password,
Country, State, City, Address, Zip) Values('" & request("FirstName") & "',
'" & request("LastName") & "', '" & request("email") & "', '" &
request("username") & "', '" & request("password") & "', '" &
request("country") & "', '" & request("state") & "', '" & request("city") &
"', '" & request("address") & "', '" & request("zip") & "')"

conn.execute(sql1)

'send email
dim b, activateCode, strCode
strCode=request("FirstName") & request("LastName") & request("email") &
request("username") & request("address")
activateCode=Len(strCode)*793

' email subject
emailsub="Please activate"

' email body
b="<html><body>"
b=b & "Hi " & fn & ",<br>"
b=b & "Welcome to " & sitename & "<br>"
b=b & "<a href='" & rootFolder & "login/activate.asp?id=" & activateCode &
"'>Click here</a> to activate your account</a>."
b=b & "<br><br>Username:<b>" & request("username") & "</b><br>Password:<b>"
& request("password") & "</b><br><br>"
b=b & "Best Regards<br><br>Tom<br>" & sitename
b=b & "</body></html>"

function checkcomp(str)
on error resume next
checkcomp = false
Err = 0
dim checkobject
set checkobject = Server.CreateObject(str)
if 0 = Err then
checkcomp = true
end if
set checkobject = nothing
Err = 0
end function

Dim emailcomp(1)

emailcomp(0) = "SMTPsvg.Mailer"
emailcomp(1) = "CDONTS.NewMail"

if checkcomp(emailcomp(0)) then
emailcomponent="ASPMail"
elseif checkcomp(emailcomp(1)) then
emailcomponent="CDONTS"
else
emailcomponent="CDONTS/ASPMail are not installed in your server."
end if

'check if ASPMail
if emailcomponent="ASPMail" then

Set mail = Server.CreateObject("SMTPsvg.Mailer")
mail.ContentType = "text/html"
mail.FromAddress = emailFromAddress
mail.FromName = emailFromName
mail.AddRecipient fullname, email
mail.Subject = emailsub
mail.BodyText = b
mail.RemoteHost = ASPMailRemoteHost
mail.SendMail
Set Mail = Nothing

'check if CDONTS
elseif emailcomponent="CDONTS" then

Set myMail = CreateObject("CDONTS.NewMail")
myMail.From = emailFromName & "<" & emailFromAddress & ">"
myMail.From = emailFromAddress
myMail.To = email
myMail.Subject = emailsub
myMail.Body = b
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Send
Set myMail = Nothing
end if

else
response.redirect "join.asp?lg=untaken&FirstName=" & request("FirstName") &
"&LastName=" & request("LastName") & "&email=" & request("email") & "&city="
& request("city") & "&address=" & request("address") & "&zip=" &
request("zip")
end if
rs.close
set rs = nothing
conn.close
set conn = nothing
Session("AfLogin")="true"
Session("activate") = false
Session("AfUsername")=username

response.redirect "members.asp?action=newuser"
%>



 
 
mcfritten (19-05-2003)
Kommentar
Fra : mcfritten


Dato : 19-05-03 12:00

Mongoose wrote in dk.edb.internet.webdesign.serverside.asp:
> Hej
> Har lige prøvet at sætte JMail ind se lige om det virker.. skriv lige
tilbage om det..
> har nedenstående script jeg har hentet - men vil gerne have tilføjet jmail -
> er der en der kan hjælpe ?
> <!--#INCLUDE file="dbase.asp"-->
> <!--#INCLUDE file="constants.asp"-->
> <%
&gt;
&gt; if request("password") <> request("password2") then
&gt; response.redirect "join.asp?lg=pwverify"
&gt; end if
&gt; email = request("email")
&gt; username = request("username")
&gt; fullname=request("FirstName") & " " & request("LastName")
&gt;
&gt; Set conn = Server.CreateObject("ADODB.Connection")
&gt; Set rs = Server.CreateObject("ADODB.Recordset")
&gt;
&gt; sql = "select AfUsername from users where AfUsername='"&
&gt; request("username")& "'"
&gt; sql2 = "select AfUsername from users where email='"& request("email")& "'"
&gt; Conn.Open dsn
&gt;
&gt; 'check if email exists
&gt; rs.open sql2, conn
&gt; if not rs.eof then
&gt; response.redirect "join.asp?lg=emailtaken&FirstName=" &
&gt; request("FirstName") & "&LastName=" & request("LastName") & "&email=" &
&gt; request("email") & "&city=" & request("city") & "&address=" &
&gt; request("address") & "&zip=" & request("zip")
&gt; end if
&gt; rs.close
&gt;
&gt; rs.open sql, conn
&gt; if rs.eof then
&gt;
&gt; sql1 = "INSERT INTO users(FirstName, LastName, EMail, AfUsername,
Password,
&gt; Country, State, City, Address, Zip) Values('" & request("FirstName") & "',
&gt; '" & request("LastName") & "', '" & request("email") & "', '" &
&gt; request("username") & "', '" & request("password") & "', '" &
&gt; request("country") & "', '" & request("state") & "', '" & request("city")
&
&gt; "', '" & request("address") & "', '" & request("zip") & "')"
&gt;
&gt; conn.execute(sql1)
&gt;
&gt; 'send email
&gt; dim b, activateCode, strCode
&gt; strCode=request("FirstName") & request("LastName") & request("email") &
&gt; request("username") & request("address")
&gt; activateCode=Len(strCode)*793
&gt;
&gt; ' email subject
&gt; emailsub="Please activate"
&gt;
&gt; ' email body
&gt; b="<html><body>"
&gt; b=b & "Hi " & fn & ",<br>"
&gt; b=b & "Welcome to " & sitename & "<br>"
&gt; b=b & "<a href='" & rootFolder & "login/activate.asp?id=" & activateCode
&
&gt; "'>Click here</a> to activate your account</a>."
&gt; b=b & "<br><br>Username:<b>" & request("username") &
"</b><br>Password:<b>"
&gt; & request("password") & "</b><br><br>"
&gt; b=b & "Best Regards<br><br>Tom<br>" & sitename
&gt; b=b & "</body></html>"
&gt;
&gt; function checkcomp(str)
&gt; on error resume next
&gt; checkcomp = false
&gt; Err = 0
&gt; dim checkobject
&gt; set checkobject = Server.CreateObject(str)
&gt; if 0 = Err then
&gt; checkcomp = true
&gt; end if
&gt; set checkobject = nothing
&gt; Err = 0
&gt; end function
&gt;
&gt; Dim emailcomp(1)
&gt;
&gt; emailcomp(0) = "SMTPsvg.Mailer"
&gt; emailcomp(1) = "CDONTS.NewMail"
&gt; emailcomp(2) = "JMail.Message"
&gt;
&gt; if checkcomp(emailcomp(0)) then
&gt; emailcomponent="ASPMail"
&gt; elseif checkcomp(emailcomp(1))
&gt; emailcomponent="CDONTS"
&gt; elseif checkcomp(emailcomp(2)) then
&gt; emailcomponent="JMail"
&gt; else
&gt; emailcomponent="CDONTS/ASPMail/JMail are not installed in your server."
&gt; end if
&gt;
&gt; 'check if ASPMail
&gt; if emailcomponent="ASPMail" then
&gt;
&gt; Set mail = Server.CreateObject("SMTPsvg.Mailer")
&gt; mail.ContentType = "text/html"
&gt; mail.FromAddress = emailFromAddress
&gt; mail.FromName = emailFromName
&gt; mail.AddRecipient fullname, email
&gt; mail.Subject = emailsub
&gt; mail.BodyText = b
&gt; mail.RemoteHost = ASPMailRemoteHost
&gt; mail.SendMail
&gt; Set Mail = Nothing
&gt;
&gt; 'check if CDONTS
&gt; elseif emailcomponent="CDONTS" then
&gt;
&gt; Set myMail = CreateObject("CDONTS.NewMail")
&gt; myMail.From = emailFromName & "<" & emailFromAddress & ">"
&gt; myMail.From = emailFromAddress
&gt; myMail.To = email
&gt; myMail.Subject = emailsub
&gt; myMail.Body = b
&gt; myMail.BodyFormat = 0
&gt; myMail.MailFormat = 0
&gt; myMail.Send
&gt; Set myMail = Nothing
&gt;
&gt; 'check if JMail
&gt; elseif emailcomponent="JMail" then
&gt;
&gt; set msg = Server.CreateOBject( "JMail.Message" )
&gt; msg.Logging = true
&gt; msg.silent = true
&gt; msg.From = "test@mydomain.com"
&gt; msg.FromName = "My Realname"
&gt; msg.AddRecipient "recipient@hisDomain.com", "His Name"
&gt; msg.AddRecipient "recipientelle@herDomain.com"
&gt; msg.Subject = "How you doin?"
&gt; msg.Body = "Hello Jim" & vbCrLf & vbCrLf & "How's it going? ..."
&gt; if not msg.Send("mail.myDomain.net" ) then
&gt; Response.write "<pre>" & msg.log & "</pre>"
&gt; else
&gt; Response.write "Message sent succesfully!"
&gt; end if
&gt;
&gt; else
&gt; response.redirect "join.asp?lg=untaken&FirstName=" & request("FirstName")
&
&gt; "&LastName=" & request("LastName") & "&email=" & request("email") &
"&city="
&gt; & request("city") & "&address=" & request("address") & "&zip=" &
&gt; request("zip")
&gt; end if
&gt; rs.close
&gt; set rs = nothing
&gt; conn.close
&gt; set conn = nothing
&gt; Session("AfLogin")="true"
&gt; Session("activate") = false
&gt; Session("AfUsername")=username
&gt;
&gt; response.redirect "members.asp?action=newuser"
&gt; %>
>
>


--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! => http://www.html.dk/tutorials

Søg
Reklame
Statistik
Spørgsmål : 177559
Tips : 31968
Nyheder : 719565
Indlæg : 6408935
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste