webForumDet fria alternativet

hjälp med att byta ut cdonts till aspsmartmail i scriptet

24 svar · 624 visningar · startad av medialabs

medialabsMedlem sedan mars 20023 686 inlägg
#1

SKulle behöva hjälp med att byta ut cdonts mailen till Aspsmartmail istället.....
--------------------------------------------
<html>
<title>CodeAve.com(404 - File Not Found)</title>
<body bgcolor="#FFFFFF">

<% querystring=trim(replace(request.servervariables("query_string"),"404;",""))
' Grab the server varible for querystring. If the user was redirected to
' this page beacuse a file was not found the server variable query_string
' would contain a string similar to this convention
' 404;http://www.yourservsername.com/name_of_missing_file.ext
' for display pirposes the 404; is removed via text replace

if querystring <> "" then %>
The item you were looking for <br>
<%= querystring %> <br>
could not be located on the server.<br>
An email message has been sent to the webmaster to correct this ASAP.<p>
<%
' If you have CDONTS installed this will send a mail message to any address you want
' However, this portion of the script has been commented out to avoid us getting mail
' from the output of this script

if right(referrer,3) <> "ico" then
' Check to see if the file missing is an ico request
' IE 5 looks for it everywhere and you may want to filter it out
' as a 404 error for an favicon.ico or one with a broken link in
' LINK REL="SHORTCUT ICON" will not result in the user being redirected to this page

' Here we begin building our mail message varible
' by stating which document as missing and when the error occurred
' and follwing it with all the servervaribles (This will tell which browser
' they were using and a few other helpful items
' message = message + "The following page was requested and not found on the server at " & now() &chr(13)
' message = message & querystring & "<br> Below are all the server varibles for the request<p>" & message_rpt

' set sm = server.createobject("CDONTS.newmail")
' Create the CDONTS mail object

' sm.from = "from_mail_address@yourserver.com"
' sm.to = "to_mail_address@yourserver.com"
' Set the mail adress for the sender and the mail address that
' will receive the message they both should be valid addresses

' sm.subject = "File Not Found - "& querystring
' Create a subject with name of the location that was requested

' sm.bodyformat = 0 'if sending as HTML
' sm.mailformat = 0 'if sending as HTML
' Place the mail format to html

' sm.body = message
' Set the body of the message equal to the text string created

' sm.send
' Send the mail message

' set sm = nothing
' Clean up the server

end if 'End check for .ico files

else
' If a user were to directly hit your 404 error page
' without generating an error display this alternate message
%>
You have reaced the 404 error page however,<br>
we could not detect a broken link or a missing file<p>
<% end if 'end check of querystring values %>
To return to the page you were previously on click <a href="javascript:history.back()">here</a>.

</body>
</html>
------------------------------------

MVH
OJJE

icq: 126670708
msn: javawebb@swipnet.se
---------------------------------
Behöver hjälp med detta nu!! =)

medialabsMedlem sedan mars 20023 686 inlägg
#2

Snäll! =(

Kan ingen hjälpa mig??

Skulle vara otroligt tacksam om man fick hjälp med detta!!!

solbulleMedlem sedan mars 20015 287 inlägg
#3

Har du försökt?

http://www.aspsmart.com/

<HTML> <BODY BGCOLOR="white">  
<H1>aspSmartMail : Sample 1</H1> <HR> 
<%  	On error resume next  
	Dim mySmartMail 	
Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail")  '	Mail Server '	*********** 	mySmartMail.Server = "mail.yourdomain.com"  '	From '	**** 	mySmartMail.SenderName = "Your Name" 	mySmartMail.SenderAddress = "youremail@yourdomain.com"  '	To '	** 	mySmartMail.Recipients.Add "yourfriend@anydomain.com", "Friend's name"  '	Message '	******* 	mySmartMail.Subject = "aspSmartMail Sample 1" 	mySmartMail.Body = "This mail has been sent with aspSmartMail."  '	Send the message '	**************** 	mySmartMail.SendMail  	if Err.Number<>0 then  		Response.write "Error: " & Err.description  	else  		Response.write "An e-mail has just been sent to " & mySmartMail.Recipients.Item(1).Name & "."  	end if  %> </body> </html>

red. asch, inte gick det att klistra in det där inte...

solbulleMedlem sedan mars 20015 287 inlägg
#4

Tror detta bör fungera, du får ändra alla epostadresser o server.

<html> 
<title>CodeAve.com(404 - File Not Found)</title> 
<body bgcolor="#FFFFFF"> 

<% querystring=trim(replace(request.servervariables("query_string"),"404;","")) 
' Grab the server varible for querystring. If the user was redirected to 
' this page beacuse a file was not found the server variable query_string 
' would contain a string similar to this convention 
' 404;[url]http://www.yourservsername.com/name_of_missing_file.ext[/url] 
' for display pirposes the 404; is removed via text replace 

if querystring <> "" then %> 
The item you were looking for <br> 
<%= querystring %> <br> 
could not be located on the server.<br> 
An email message has been sent to the webmaster to correct this ASAP.<p> 
<% 

if right(referrer,3) <> "ico" then 
' Check to see if the file missing is an ico request 
' IE 5 looks for it everywhere and you may want to filter it out 
' as a 404 error for an favicon.ico or one with a broken link in 
' LINK REL="SHORTCUT ICON" will not result in the user being redirected to this page 

' Here we begin building our mail message varible 
' by stating which document as missing and when the error occurred 
' and follwing it with all the servervaribles (This will tell which browser 
' they were using and a few other helpful items 
' message = message + "The following page was requested and not found on the server at " & now() &chr(13) 
' message = message & querystring & "<br> Below are all the server varibles for the request<p>" & message_rpt 

Dim mySmartMail 	
Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail") 

'	Mail Server 
'	***********
	mySmartMail.Server = "mail.yourdomain.com" 

'	From 
'	****
 	mySmartMail.SenderName = "Your Name"
 	mySmartMail.SenderAddress = "youremail@yourdomain.com"  
'	To 
'	**
 	mySmartMail.Recipients.Add "youremail@anydomain.com", "Your Name"

' Set the mail adress for the sender and the mail address that 
' will receive the message they both should be valid addresses 

' mySmartMail.Subject  = "File Not Found - "& querystring 
' Create a subject with name of the location that was requested 

' mySmartMail.Body = message 
' Set the body of the message equal to the text string created 

' mySmartMail.SendMail 
' Send the mail message 

end if 'End check for .ico files 

else 
' If a user were to directly hit your 404 error page 
' without generating an error display this alternate message 
%> 
You have reaced the 404 error page however,<br> 
we could not detect a broken link or a missing file<p> 
<% end if 'end check of querystring values %> 
To return to the page you were previously on click <a href="java script:history.back()">here</a>. 

</body> 
</html>

Red. mailserver finns nu.

medialabsMedlem sedan mars 20023 686 inlägg
#5

d

Var ska jag ställa in Min mail server.

D.v.s : mail.domain.com ??

solbulleMedlem sedan mars 20015 287 inlägg
#6

Hupp, de raderna "försvann" visst:

' Mail Server
' ***********
mySmartMail.Server = "mail.yourdomain.com"

Sätter du in efter raden:

Set mySmartMail = Server.CreateObject("aspSmartMail.SmartMail")

medialabsMedlem sedan mars 20023 686 inlägg
#7

Tack!

Nu funkar 404 sidan som den skaoch jag får ett mail varje gång man kommer till en "trasig" sida!

solbulleMedlem sedan mars 20015 287 inlägg
#8

Kul :birp

medialabsMedlem sedan mars 20023 686 inlägg
#9

RE

Detta är mailet jag får tillbaka.
--------------------------
Från: OJJE <noreply@domain.fdfdf> Svara
Ämne: File Not Found - http://www.domain.com/fdsf.asp
Datum: Sat, 30 Mar 2002 01:49:50, +0100

--------------------------------------------------------------------------------

The following page was requested and not found on the server at 2002-03-30 01:49:50
http://www.domain.nu/fdsf.asp Below are all the server varibles for the request

--------------------------------

Vet du hur man snyggar upp detta??
Så att det blir lättare att kolla på detta och om man kan includera besökarens ip adress???

solbulleMedlem sedan mars 20015 287 inlägg
#10

Nu ska du få så du tiger ;)

Släng in detta: (byt ut, ja du fattar)

 message = message + "Denna sida söktes men hittades inte på servern vid: " & now() &chr(13) 
 message = message & "<br>" & querystring & "<br> Här följer fakta om webläsaren mm:<p>" 

For Each objItem In Request.ServerVariables
 message = message & objItem & ": " & Request.ServerVariables(objItem) & "<BR>"
Next

Vill du inte ha all den faktan kan du köra typ:


 message = message + "Denna sida söktes men hittades inte på servern vid: " & now() &chr(13) 
 message = message & "<br>" & querystring & "<br> Här följer fakta om webläsaren mm:<p>" 
 message = message & "Refererande sida: " & request.servervariables("remote_addr")
 message = message & "IP-adress: " & request.servervariables("remote_addr")
medialabsMedlem sedan mars 20023 686 inlägg
#11

=)

Hehe, blev mycket snyggare direkt! tack! tack!!

hehe.. har du mer att komma med eller tog det slut nu?! :OO :bire

solbulleMedlem sedan mars 20015 287 inlägg
#12

Hm... vad vill du mer ha nu då?

En tanke bara, du har aldrig tänkt på att gå o lägga dig o så? :e

medialabsMedlem sedan mars 20023 686 inlägg
#13

allt som går!

Hehe.. Sova??
det har jag inte gjort på länge... sitter med en Coca Cola här och kollar på Jay Leno show!

Men vad mer skulle man kunna inkluidera på en 404 sida???

solbulleMedlem sedan mars 20015 287 inlägg
#14

Attans, vi kan nog ta varann i hand :birp

Prövade du det övre av scriptsnuttarna? Den med For each osv.
Den listar alla servervariabler du kan få reda på, du kan ju välja att bara plocka ut de som du vill ha. (Som vi gjorde i det nedre exemplet.)

medialabsMedlem sedan mars 20023 686 inlägg
#15

Ja,

Jag använder den nedre kåååden. men jag ska slänga ett öga på den övre raden imorrn :OO

Nä, nu är det dags att låta datorn svalna ett par timmar. :r

Men jag är evigt tacksam för all hjälp jag har fått av dig! :bire :birp

Sov gått! :stud

dendåligeMedlem sedan jan. 2003188 inlägg
#16

hmm en liten fråga bara??? vad har du skrivit på html sidan?? behöver lite hjälp med den...

medialabsMedlem sedan mars 20023 686 inlägg
#17

dendålige skrev:

hmm en liten fråga bara??? vad har du skrivit på html sidan?? behöver lite hjälp med den...

vad menar du med HTML sidan?

dendåligeMedlem sedan jan. 2003188 inlägg
#18

alltså... om man kopplar felmeddalnden direkt till en .asp fil så funkar det ju inte... så som jag har gjort nu är att jag har en html fil som sedan skickas atomatiskt till en asp fil som visar felmeddalandet och skickar ett mejl... men hur har du gjort då??

medialabsMedlem sedan mars 20023 686 inlägg
#19

dendålige skrev:

alltså... om man kopplar felmeddalnden direkt till en .asp fil så funkar det ju inte... så som jag har gjort nu är att jag har en html fil som sedan skickas atomatiskt till en asp fil som visar felmeddalandet och skickar ett mejl... men hur har du gjort då??

jag döpte den till 404.asp istället för en html fil.....

dendåligeMedlem sedan jan. 2003188 inlägg
#20

mm... det gjorde jag också... men då funkade den inte som en asp fil... och om man högerklickade och visade källa... så såg man all kod... även asp koden... och det skickades inget mejl...

149 ms totalt · 3 externa anrop · v20260731065814-full.fb544a5a
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
146 ms — hämta tråd, inlägg och bilagor (db)