JMail...
Jeg er ved at lave et "send nyhed til ven" script, med brug af JMail, men det virker ikke rigtigt.Her er koden:
<!--#include file="includes/functions.asp"-->
<!--#include file="includes/inc_top.asp"-->
<%
If Request("NID") <> "" Then
NID = Request("NID")
If Request.Form("Send") <> "" Then
strError = ""
strFriendsEmail = Trim(Request.Form("FriendsEmail"))
strYourEmail = Trim(Request.Form("YourEmail"))
If Len(strFriendsEmail) = 0 Then
strError = "Please type your friends email!<br>"
End If
If Len(strYourEmail) = 0 Then
strError = strError & "Please type your own email!<br>"
End If
If checkEmail(strFriendsEmail) = False Then
strError = strError & "Your friends email have to a valid email!<br>"
End If
If checkEmail(strYourEmail) = False Then
strError = strError & "Your email have to a valid email!<br>"
End If
If Len(strError) = 0 Then
Set conntemp = Server.CreateObject("ADoDB.Connection")
conntemp.Open DSN
strSQL = "SELECT * FROM News WHERE NID = "& Request("NID")
set rsSendToFriend = conntemp.execute(strSQL)
strSubject = rsSendToFriend("N_SUBJECT")
strDate = FormatDate(rsSendToFriend("N_DATE"), 3)
strAlias = rsSendToFriend("N_ALIAS")
strText = Break(rsSendToFriend("N_TEXT"))
On Error Resume Next
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ISOEncodeHeaders = False
JMail.ServerAddress = "vip.cybercity.dk"
JMail.Sender = strYourEmail
JMail.Subject = "News sendt from team-soa.com"
JMail.AddRecipient strFriendsEmail
JMail.Priority = 3
JMail.Body = strSubject & vbcrlf &"Added: "& strDate &" - By: "& strAlias & vbcrlf & strText
JMail.Execute
Response.Write ("The news have been sendt to your friend!")
Else
strError = "<b>"& strError &"</b>"
End If
End If
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" valign="middle" background="images/header.gif" height="20">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" align="center"><font size="2"><b>Send news to a friend</b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<form action="sendtofriend.asp" method="post">
<br>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"><font class="content"><%=strError%></font></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="55%"> </td>
<td width="45%"><font class="content">Your friends email</font></td>
</tr>
<tr>
<td width="55%"> </td>
<td width="45%"><input class="box" name="FriendsEmail" size="25"></td>
</tr>
<tr>
<td width="55%"> </td>
<td width="45%"><font class="content">Your email</font></td>
</tr>
<tr>
<td width="55%"> </td>
<td width="45%"><input class="box" name="YourEmail" size="25"></td>
</tr>
<tr>
<td width="55%"> </td>
<td width="45%"><input type="submit" name="Send" value=" Send "></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<hr size="1" color="#000000" noshade>
</td>
</tr>
</table>
<% End If %>
<!--#include file="includes/inc_footer.asp"-->
Jeg kan ikke finde ud, om det har noget med JMail som er sat ordenligt op eller om det har noget med resten af scriptet at gøre.
Det skal dog lige siges, at det er første gang, jeg arbejde med mail i ASP.
På forhånd tak!
