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"-->
> <%
>
> 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"
> emailcomp(2) = "JMail.Message"
>
> if checkcomp(emailcomp(0)) then
> emailcomponent="ASPMail"
> elseif checkcomp(emailcomp(1))
> emailcomponent="CDONTS"
> elseif checkcomp(emailcomp(2)) then
> emailcomponent="JMail"
> else
> emailcomponent="CDONTS/ASPMail/JMail 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
>
> 'check if JMail
> elseif emailcomponent="JMail" then
>
> set msg = Server.CreateOBject( "JMail.Message" )
> msg.Logging = true
> msg.silent = true
> msg.From = "test@mydomain.com"
> msg.FromName = "My Realname"
> msg.AddRecipient "recipient@hisDomain.com", "His Name"
> msg.AddRecipient "recipientelle@herDomain.com"
> msg.Subject = "How you doin?"
> msg.Body = "Hello Jim" & vbCrLf & vbCrLf & "How's it going? ..."
> if not msg.Send("mail.myDomain.net" ) then
> Response.write "<pre>" & msg.log & "</pre>"
> else
> Response.write "Message sent succesfully!"
> 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"
> %>
>
>
--
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