hjælp til forum med Jmail
Jeg har fundet dette forum, hvor der er kommet en Jmail funktion på. Det skal fungere således at når der kommer et indlæg eller svar, bliver der sendt en mail.HVem kan hjælpe mig med at få sat det rigtigt op.
<!-- #include file="../databaseforbindelse.asp"-->
<%
//Udvikler: Anders Pedersen
//E-mail: anders@altforlaekker.dk
//Hjemmeside: http://svalde.dyndns.dk
%>
<% mode = request("mode") %>
<title>:: F O R U M ::</title>
<link href="main_css.css" type="text/css" rel="stylesheet">
<% If mode="" then %>
<table height="100%" width="100%" border="1">
<tr>
<td><iframe src="default.asp?mode=indlaeg" height="45%" width="100%" frameborder="1">
</td>
</tr>
<tr>
<td valign="bottom"><iframe src="" height="55%" width="100%" frameborder="1" name="main_iframe"></td>
</tr>
</table>
<% End IF %>
<% If mode="indlaeg" then %>
<% strSQL = "Select * from forum Order By Dato Desc"
strSQL2= "Select* from forum_svar"
Set rs = Conn.Execute(strSQL)
Set rs2= Conn.Execute(strSQL2) %>
<a href="default.asp?mode=opret">Opret indlæg</a>
<hr align="left" color="#066A9E" width="100%" size="1">
<table width="100%" border="0">
<% Do While Not rs.EOF %>
<tr onmouseover="java script:this.style.backgroundColor='066A9E';" onmouseout="java script:this.style.backgroundColor='#FFFFFF';">
<td><a href="default.asp?ID=<% Response.Write rs("id") %>&EmneID=<% Response.Write rs("id") %>&mode=read" class="9pt" target="main_iframe"><% Response.Write rs("Titel") %></A></td>
<td><font class="9pt"><% Response.Write rs("Bruger") %></FONT></td>
<td><font class="9pt"><% Response.Write rs("Dato") %></FONT></td>
</tr>
<% rs.MoveNext %>
<% Loop %>
</table>
<% Conn.Close %>
<% End IF %>
<% If mode = "read" then %>
<% strSQL = "Select* from forum Where ID=" & Request("ID")
strSQL2= "Select* From Forum_svar Where EmneID=" & Request("ID") & " Order By Dato Desc"
Set rs = Conn.Execute(strSQL)
Set rs2= Conn.Execute(strSQL2) %>
<a href="default.asp?titel=<% Response.Write rs("titel") %>&EmneID=<% Response.Write Request("emneid") %>&mode=indlaeg_bsv">Reply</a>
<hr align="left" color="#066A9E" width="100%" size="1">
<table width="100%" border="0">
<tr valign="top">
<td width="100%" bgcolor="#066A9E"><font class="9pt_hv"><% Response.Write rs("Titel") %></font></TD>
</tr>
<tr valign="top">
<td width="100%"><font class="9pt"><% Response.Write (Replace(rs("Diskusion"), vbCrLf, "<br>")) %></font></TD>
</tr>
</table>
<br>
<table width="100%" border="0">
<% Do While Not rs2.EOF %>
<tr valign="top">
<td width="100%" bgcolor="#066A9E"><font class="9pt_hv"><% Response.Write rs2("Titel") %></font></TD>
</tr>
<tr valign="top">
<td width="100%"><font class="9pt"><% Response.Write (Replace(rs2("Svar"), vbCrLf, "<br>")) %></font></TD>
</tr>
<% rs2.MoveNext %>
<% Loop %>
</table>
<% Conn.Close %>
<% End IF %>
<% If mode = "opret" then %>
<font class="8pt_gray">Create Post</font>
<hr align="left" color="#066A9E" width="100%" size="1">
<form action="default.asp?mode=Action" method="POST" name="Opret_indlaeg">
<table align="left" border="0">
<tr>
<td><font class="9pt">Title:</font></td>
<td><input type="text" name="Titel" class="all"></td>
<td></td>
</tr>
<tr>
<td><font class="9pt">Name:</font></td>
<td><input type="text" class="all" NAME="Navn"></td>
<td></td>
</tr>
<tr valign="top">
<td><font class="9pt">Post:</font></td>
<td><textarea wrap="physical" rows="7" cols="60" name="Indlaeg" class="all"></textarea></td>
<td valign="bottom"><input type="submit" value="Post" name="Opret" class="all"></td>
</tr>
</table>
</form>
<% End IF %>
<% If mode = "indlaeg_bsv" then %>
<font class="8pt_gray">Reply</font>
<hr align="left" color="#066A9E" width="100%" size="1">
<form action="default.asp?EmneID=<% Response.Write Request("emneid") %>&mode=Action" method="POST" name="Opret_bsv">
<table align="left" border="0">
<tr>
<td><font class="9pt">Title:</font></td>
<td><input type="text" value="Re: <% Response.Write Request("titel") %>" name="Titel" class="all"></td>
<td></td>
</tr>
<tr>
<td><font class="9pt">Name:</font></td>
<td><input type="text" class="all" name="Navn"></td>
<td></td>
</tr>
<tr valign="top">
<td><font class="9pt">Post:</font></td>
<td><textarea wrap="physical" rows="10" cols="60" name="Indlaeg" class="all"></textarea></td>
<td valign="bottom"><input type="submit" value="Anwser" name="Opret" class="all"></td>
</tr>
</table>
</form>
<% End IF %>
<% if mode="Action" then %>
<% if Request("Opret") = "Post" then
strTitel = Trim(Replace(request("Titel"),"'","''" ))
strIndlaeg = Trim(Replace(request("Indlaeg"),"'","''" ))
strSQL = "Insert into forum(Titel, Bruger, Email, Diskusion) values('" & strTitel & "','" & Request("Navn") & "','" & Request("Email") & "','" & strIndlaeg & "')"
Conn.Execute(strSQL)
'send email
email_tekst = strTitel & "<br><br>" & strIndlaeg
strSQL_email = "select * from tblBrugerInfo"
set rs_email = conn.execute(strSQL_email)
if not rs_email.eof then
do
'email_til = rs_email("email_adresse")
'
'Set JMail = Server.CreateObject ("JMail.SMTPMail")
'
'' dette er mailserveren - kan også være din egen
'JMail.ServerAddress = "mail.ditwebhotel.dk"
'
'' afsender
'JMail.Sender = "post@dinmailadresse.dk"
'JMail.Subject = "oprettet emne"
'JMail.ContentType = "text/html"
'
'' modtager email
'JMail.AddRecipient email_til
'
'JMail.Body = email_tekst
'JMail.Priority = 3
'
'JMail.Execute
' JMail.ClearRecipients
set msg = Server.CreateOBject( "JMail.Message" )
msg.ContentType = "text/html"
msg.Logging = true
msg.silent = true
msg.From = "post@dinmailadresse.dk"
msg.FromName = "Remo International"
msg.AddRecipient rs_email("email")
msg.Subject = "Nyt indlæg på forum"
msg.Body = body
if not msg.Send("mail.ditwebhotel.dk") then
Response.write msg.log
else
end if
rs_email.movenext
loop while not rs_email.eof
set rs_email = nothing
end if
'email slut
Conn.Close
Response.Redirect "?mode=indlaeg"
End if %>
<% if Request.Form("Opret") = "Anwser" then
strTitel = Trim(Replace(request("Titel"),"'","''" ))
strIndlaeg = Trim(Replace(request("Indlaeg"),"'","''" ))
strSQL = "Insert into forum_svar(Titel, Bruger, Email, Svar, EmneID) values('" & strTitel & "','" & Request.form("Navn") & "','" & Request.form("Email") & "','" & strIndlaeg & "','" & Request.QueryString("EmneID") & "')"
Conn.Execute(strSQL)
'send email
email_tekst = strTitel & "<br><br>" & strIndlaeg
strSQL_email = "select * from email_tabel"
set rs_email = conn.execute(strSQL_email)
if not rs_email.eof then
do
email_til = rs_email("email_adresse")
Set JMail = Server.CreateObject ("JMail.SMTPMail")
' dette er mailserveren - kan også være din egen
JMail.ServerAddress = "mail.ditwebhotel.dk"
' afsender
JMail.Sender = "post@dinmailadresse.dk"
JMail.Subject = "oprettet emne"
JMail.ContentType = "text/html"
' modtager email
JMail.AddRecipient email_til
JMail.Body = email_tekst
JMail.Priority = 3
JMail.Execute
JMail.ClearRecipients
rs_email.movenext
loop while not rs_email.eof
set rs_email = nothing
end if
'email slut
Conn.Close
Response.Redirect "?mode=read&EmneID=" & Request("emneid") & "&ID=" & Request("emneid")
End if %>
<% End if %>