Hej Hjælp til at finde fejlen
HejJeg har brugt følgende script
http://www.stardeveloper.com/articles/display.html?article=2000032001&page=1
I dette script er der en side hvor man kan skrive en mail i en formular. Denne sendes så til brugerne i databasen.
Dette virker dog ikke.
Jeg håber derfor der er en venlig sjæl der vil kigge på følgende kode.
Det skal siges jeg bruger et webhotel hos cliche. De skriver de understøter jmail
<%
' Declaring variables
Dim rs, mail, subject, message, data_source, sql_select, no, strFromEmail, strFromName, strSendToEmail, strSendToName, strSubject, strBody, strMailServer
no = 0
subject = Request.Form("subject")
message = Request.Form("message")
' Adding a link to all messages by which users can delete their emails
' if they want later
message = message & vbcrlf & vbcrlf & "To stop receiving emails click here :"
message = message & vbcrlf & "http://www.............../del.asp?email="
sql_select = "select email from users"
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("mail.mdb")
' Check to see if you have not pressed the 'send' button mistakenly
If Len(message) Then
' If you have written some message then lets send it
' You can use ASP Email component of your choice, here I will stick with CDO
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql_select, data_source
strFromEmail = "info@.........dk"
strFromName = "mig"
strSendToEmail = "my.email@somedomain.net"
strSendToName = "Some name"
strSubject = "Here you go..."
strBody = "This is an email for..."
strMailServer = "smtp.cliche.dk"
While Not rs.EOF
Set mail = Server.CreateObject("JMail.SMTPMail")
Mail.From = "info@s......dk"
Mail.AddRecipient = rs("email")
Mail.Subject = subject
Mail.Body = message & rs("email")
Mail.Send(strMailServer)
Set mail = Nothing
Response.Write "Email sent to : " & rs("email") & "<br>"
no = no + 1
rs.MoveNext
Wend
' When messages have been sent to all the users, exit
Response.Write "Emails sent to " & no & " users."
rs.Close
Set rs = Nothing
' Had you pressed the button mistakenly with text area empty, then
' redirect back to the HTML Form
Else
Response.Redirect "admin.htm"
End If
%>