how i can test? can i enable by my self?
for your reference i am sending you coding, kindly check is this ok or not. i have checked a speace of code of PHP also, which is working at Linux server, but here saying "can't send mail"
here is the both links:
<a href="http://www.alsoc.org/alsoc/sendmail/sampleform.htm" rel="nofollow">http://www.alsoc.org/alsoc/sendmail/sampleform.htm</a>[<a href="http://www.alsoc.org/alsoc/sendmail/sampleform.htm" target="_blank" rel="nofollow" title="New Window">^</a>]
<a href="http://www.alsoc.org/alsoc/feedback_form1.asp" rel="nofollow">http://www.alsoc.org/alsoc/feedback_form1.asp</a>[<a href="http://www.alsoc.org/alsoc/feedback_form1.asp" target="_blank" rel="nofollow" title="New Window">^</a>]
above to form i have down load from here bu both are not running. here are the code:
feedback_form.asp
<% @ Language=VBScript %><br />
<% Option Explicit<br />
response.buffer=true%><br />
<% dim num<br />
num = Request.ServerVariables("SCRIPT_NAME")<br />
application.lock<br />
if isEmpty(application(num)) Then<br />
application(num)=0<br />
END IF<br />
application(num)=application(num)+1<br />
application.unlock<br />
%><br />
<%<br />
dim newmail, strfeed, ipadd, brow, now, msgbody, date, strnam, stremail, strcom, strsug<br />
brow = Request.servervariables("HTTP_USER_AGENT")<br />
ipadd= Request.ServerVariables("REMOTE_ADDR")<br />
date = time<br />
strfeed = request.cookies("Feed")("Yes")<br />
if (Len(strfeed) > 0) then<br />
response.write "<font color=red>You have already given us feedback! You can give it again after a week!</font>"<br />
response.redirect "index.asp"<br />
end if<br />
strnam = Trim(Request.Form("name"))<br />
stremail = Trim(request.form("mail"))<br />
strcom = Trim(request.form("com"))<br />
strsug = Trim(request.form("sug"))<br />
num = application(num)<br />
msgbody = ("Suggestions: " & strsug & "Comments: " & strcom & vbcrlf & "PC info:" & "IP:" & ipadd & "Browser: " & brow & "Time:" & date & "Hits:" & num &"times!")<br />
if (strnam <> "" and stremail <> "" and strcom <> "" and strsug <> "")then<br />
Set Newmail = Server.CreateObject ("CDONTS.newmail")<br />
Newmail.From = stremail<br />
Newmail.To = "alsoc@alsoc.org"<br />
Newmail.Subject = "Feedback From:" & strnam<br />
Newmail.Body = msgbody<br />
Newmail.Send<br />
Set Newmail = Nothing <br />
response.write "send mail"<br />
<br />
End if <br />
%><br />
<html><br />
<br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><br />
<title>Sample Feedback Form : Gopi Aravind</title><br />
<script language="JavaScript1.2"><br />
var bookmarkurl="http://www.codeproject.com"<br />
var bookmarktitle="The Code Project - Free Source Code and Tutorials"<br />
function addbookmark()<br />
{<br />
if (document.all)<br />
window.external.AddFavorite(bookmarkurl,bookmarktitle)<br />
}<br />
</script><br />
</head><br />
<br />
<body bgcolor="#FFFFFF"><br />
<br />
<script language=JavaScript><br />
<!--<br />
<br />
<br />
var message="";<br />
function clickIE() {if (document.all) {(message);return false;}}<br />
function clickNS(e) {if <br />
(document.layers||(document.getElementById&&!document.all)) {<br />
if (e.which==2||e.which==3) {(message);return false;}}}<br />
if (document.layers) <br />
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}<br />
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}<br />
<br />
document.oncontextmenu=new Function("return false")<br />
</script><br />
<br />
<p align="left"><font size="7" color="#00CCFF"> F</font>eedback<br />
<font size="7" color="#00CCFF">F</font>orm</p><br />
<br />
<div align="right"><br />
<br />
<table border="0" cellspacing="1" id="AutoNumber2"><br />
<form action="<%= Request.ServerVariables("SCRIPT_Name") %>" method="POST"><br />
<br />
<tr><br />
<td> </td><br />
<td><font color="#808080"><code>Name: Email Id: YourComments: Suggestions:
By: Gopi Aravind
Go here:
<font color="#FF0000"><br />
<a style="text-decoration: none" href="http://www.trollzsoft.com/feedback.asp"><br />
http:
for an ever lasting sample!
Mail me at:
webmaster@trollzsoft.com
Bookmark
www.codeproject.com
Set as Codeproject.com as HomePage
Copyright © 2003-2004 Gopi Aravind. <br />
This code is for free distribution only.
All Rights Reserved.
<font color="#C0C0C0">Contact the webmaster:<br />
<a href="mailto:webmaster@trollzsoft.com?subject=From the Homepage!">Gopi <br />
Aravind</a></font>
sendmail.asp
<%<br />
'---------------------------------------------------------------------------------------------------<br />
'FORM MAIL SCRIPT<br />
'----------------<br />
'usage:<br />
'<form ACTION="sendmail.asp" ...><br />
'<br />
'Hidden fields to use in the form:<br />
' redirect - the url to redirect to when the mail has been sent (REQUIRED)<br />
' mailto - the email address of the recipient (separate multiple recipients with commas) (REQUIRED)<br />
' cc - the email address of the cc recipient (separate multiple recipients with commas) (OPTIONAL)<br />
' bcc - the email address of the bcc recipient (separate multiple recipients with commas) (OPTIONAL)<br />
' mailfrom - the email address of the sender (REQUIRED)<br />
' subject - the subject line of the email (REQUIRED)<br />
' message - the message to include in the email above the field values. not used when a template is<br />
' being used. (OPTIONAL)<br />
' template - specifies a text or html file to use as the email template, relative to the location of the<br />
' sendmail script. (e.g. ../email.txt) Templates should reference form fields like this: [$Field Name$]<br />
' html - if this has the value "yes", the email will be sent as an html email. only used if a template is supplied.<br />
' testmode - if this is set to "yes", the email contents will be written to the screen instead of being emailed.<br />
'---------------------------------------------------------------------------------------------------<br />
<br />
option explicit<br />
<br />
function getTextFromFile(path)<br />
dim fso, f, txt<br />
set fso = createobject("Scripting.FileSystemObject")<br />
if not fso.fileexists(path) then<br />
getTextFromFile = ""<br />
exit function<br />
end if<br />
set f = fso.opentextfile(path,1)<br />
if f.atendofstream then txt = "" else txt = f.readall<br />
f.close<br />
set f = nothing<br />
set fso = nothing<br />
getTextFromFile = txt<br />
end function<br />
<br />
dim redir, mailto, mailfrom, subject, item, body, cc, bcc, message, html, template, usetemplate, testmode<br />
redir = request.form("redirect")<br />
mailto = request.form("mailto")<br />
cc = request.form("cc")<br />
bcc = request.form("bcc")<br />
mailfrom = request.form("mailfrom")<br />
subject = request.form("subject")<br />
message = request.form("message")<br />
template = request.form("template")<br />
testmode = lcase(request.form("testmode"))="yes"<br />
<br />
if len(template) > 0 then template = getTextFromFile(server.mappath(template))<br />
if len(template) > 0 then usetemplate = true else usetemplate = false<br />
dim msg : set msg = server.createobject("CDONTS.NewMail")<br />
if usetemplate and lcase(request.form("html")) = "yes" then<br />
msg.bodyformat = 0 '(html)<br />
msg.mailformat = 0 '(mime)<br />
end if<br />
msg.subject = subject<br />
msg.to = mailto<br />
msg.from = mailfrom<br />
if len(cc) > 0 then msg.cc = cc<br />
if len(bcc) > 0 then msg.bcc = bcc<br />
<br />
if not usetemplate then<br />
body = body & message & vbcrlf & vbcrlf<br />
else<br />
body = template<br />
end if<br />
for each item in request.form<br />
select case item<br />
case "redirect", "mailto", "cc", "bcc", "subject", "message", "template", "html", "testmode"<br />
case else<br />
if not usetemplate then<br />
if item <> "mailfrom" then body = body & item & ": " & request.form(item) & vbcrlf & vbcrlf<br />
else<br />
body = replace(body, "[$" & item & "$]", replace(request.form(item),vbcrlf,"<br>"))<br />
end if<br />
end select<br />
next<br />
<br />
if usetemplate then 'remove any leftover placeholders<br />
dim rx : set rx = new regexp<br />
rx.pattern = "\[\$.*\$\]"<br />
rx.global = true<br />
body = rx.replace(body, "")<br />
end if<br />
<br />
msg.body = body<br />
if testmode then<br />
if lcase(request.form("html")) = "yes" then<br />
response.write "<pre>" & vbcrlf<br />
response.write "Mail to: " & mailto & vbcrlf<br />
response.write "Mail from: " & mailfrom & vbcrlf<br />
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf<br />
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf<br />
response.write "Subject: " & subject & vbcrlf & string(80,"-") & "</pre>"<br />
response.write body<br />
else<br />
response.write "<html><head><title>Sendmail.asp Test Mode</title></head><body><pre>" & vbcrlf<br />
response.write "Mail to: " & mailto & vbcrlf<br />
response.write "Mail from: " & mailfrom & vbcrlf<br />
if len(cc) > 0 then response.write "Cc: " & cc & vbcrlf<br />
if len(bcc) > 0 then response.write "Bcc: " & bcc & vbcrlf<br />
response.write "Subject: " & subject & vbcrlf & vbcrlf<br />
response.write string(80,"-") & vbcrlf & vbcrlf & "<span style=""color:blue;"">"<br />
response.write body & "</span>" & vbcrlf & vbcrlf<br />
response.write string(80,"-") & vbcrlf & "**END OF EMAIL**</pre></body></html>"<br />
end if<br />
else<br />
msg.send<br />
response.redirect redir<br />
end if<br />
set msg = nothing<br />
%><br />
sampleform.htm (from where sendmail.asp get executed)
<HTML><br />
<HEAD><br />
<TITLE>Sample Form</TITLE><br />
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><br />
<!-- ImageReady Preload Script (subpage nav.psd) --><br />
<SCRIPT TYPE="text/javascript"><br />
<!--<br />
<br />
function newImage(arg) {<br />
if (document.images) {<br />
rslt = new Image();<br />
rslt.src = arg;<br />
return rslt;<br />
}<br />
}<br />
<br />
function changeImages() {<br />
if (document.images && (preloadFlag == true)) {<br />
for (var i=0; i<changeImages.arguments.length; i+=2) {<br />
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];<br />
}<br />
}<br />
}<br />
<br />
var preloadFlag = false;<br />
function preloadImages() {<br />
if (document.images) {<br />
renting_over = newImage("images/renting-over.gif");<br />
aboutus_over = newImage("images/aboutus-over.gif");<br />
contactus_over = newImage("images/contactus-over.gif");<br />
allrentallistings_over = newImage("images/allrentallistings-over.gif");<br />
newlistings_over = newImage("images/newlistings-over.gif");<br />
search_over = newImage("images/search-over.gif");<br />
preloadFlag = true;<br />
}<br />
}<br />
<br />
</SCRIPT><br />
<!-- End Preload Script --><br />
<script language="JavaScript" type="text/JavaScript"><br />
<!--<br />
function MM_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {<br />
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}<br />
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];<br />
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);<br />
if(!x && d.getElementById) x=d.getElementById(n); return x;<br />
}<br />
<br />
function MM_validateForm() {
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;<br />
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);<br />
if (val) { nm=val.name; if ((val=val.value)!="") {<br />
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');<br />
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';<br />
} else if (test!='R') { num = parseFloat(val);<br />
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';<br />
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');<br />
min=test.substring(8,p); max=test.substring(p+1);<br />
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';<br />
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }<br />
} if (errors) alert('The following error(s) occurred:\n'+errors);<br />
document.MM_returnValue = (errors == '');<br />
}<br />
</script><br />
<link href="rentalempire.css" rel="stylesheet" type="text/css"><br />
</HEAD><br />
<BODY ONLOAD="preloadImages();"><br />
<form action="sendmail.asp" method="post"><br />
<TABLE width="450" border=0><br />
<TR> <br />
<TD colSpan=2><p>Please use this form to get repairs organised for the property <br />
you are renting.</p></TD><br />
</TR><br />
<TR> <br />
<TD>Name: </TD><br />
<TD> <INPUT size=35 name="Tenants-Name"> </TD><br />
</TR><br />
<TR> <br />
<TD>Email: </TD><br />
<TD> <INPUT size=35 name="mailfrom"> </TD><br />
</TR><br />
<TR> <br />
<TD>Date: </TD><br />
<TD> <INPUT name="Date"> </TD><br />
</TR><br />
<TR> <br />
<TD>Contact Details</TD><br />
<TD> </TD><br />
</TR><br />
<TR> <br />
<TD vAlign=top> Property Address: </TD><br />
<TD> <TEXTAREA name="Property-Address" rows=2 cols=22></TEXTAREA> </TD><br />
</TR><br />
<TR> <br />
<TD>Work Phone: </TD><br />
<TD> <INPUT name="Work-Number"> </TD><br />
</TR><br />
<TR> <br />
<TD>Home Phone: </TD><br />
<TD> <INPUT name="Home-Number"> </TD><br />
</TR><br />
<TR> <br />
<TD>Mobile Phone: </TD><br />
<TD> <INPUT name="Mobile-Number"> </TD><br />
</TR><br />
<TR> <br />
<TD colSpan=2>Repair Details</TD><br />
</TR><br />
<TR> <br />
<TD vAlign=top> Repairs Required: </TD><br />
<TD> <TEXTAREA name="Repairs-required" rows=3 cols=22></TEXTAREA> </TD><br />
</TR><br />
<TR> <br />
<TD vAlign=top>Access for Tradesperson: </TD><br />
<TD><textarea name="Access-for-Tradesperson" rows=2 cols=22></textarea> <br />
</TD><br />
</TR><br />
<TR> <br />
<TD colSpan=2><div align="center"> <br />
<input name="submit" type=submit onClick="MM_validateForm('Tenants-Name','','R','mailfrom','','R','Date','','R','Property-Address','','R','Repairs-required','','R');return document.MM_returnValue" value=Send details!><br />
</div></TD><br />
</TR><br />
<TR> <br />
<TD> </TD><br />
<td><input name="redirect" type="hidden" id="redirect" value="thanks.htm"> <br />
<input name="mailto" type="hidden" id="mailto" value="alsoc@alsoc.com"> <br />
<input name="subject" type="hidden" id="subject" value="Website Form Submission: Request for Repairs"> <br />
<input name="template" type="hidden" id="template" value="emailtemplate.htm"> <br />
<input name="html" type="hidden" id="html" value="no"> </td><br />
</TR><br />
</TABLE><br />
</form><br />
</BODY><br />
</HTML>
here is the php file which is running ok at linux server but not at windows server:
this is html page url: http://www.alsoc.org/alsoc/php/pdf.html[^]
<HTML><br />
<HEAD><br />
<TITLE></TITLE><br />
<META name="description" content=""><br />
<META name="keywords" content=""><br />
<META name="generator" content="CuteHTML"><br />
<script language="javascript"><br />
<br />
function comprobadades(){<br />
sortir = 0;<br />
if (document.form1.Name.value == '') {<br />
window.alert('The fields with an * are required. Please, be sure that you fill them up.');<br />
document.form1.Name.focus();<br />
sortir = 1;<br />
}<br />
<br />
if (document.form1.Country.value == '' && sortir == 0) {<br />
window.alert('The fields with an * are required. Please, be sure that you fill them up.');<br />
document.form1.Country.focus();<br />
sortir = 1;<br />
}<br />
<br />
if (document.form1.Email.value == '' && sortir == 0) {<br />
window.alert('The fields with an * are required. Please, be sure that you fill them up.');<br />
document.form1.Email.focus();<br />
sortir = 1;<br />
}<br />
<br />
if (document.form1.Phone.value == '' && sortir == 0) {<br />
window.alert('The fields with an * are required. Please, be sure that you fill them up.');<br />
document.form1.Phone.focus();<br />
sortir = 1;<br />
}<br />
if (sortir == 0){<br />
document.form1.submit();<br />
}<br />
}<br />
</script><br />
</HEAD><br />
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080"><br />
<br />
Please fill in your details.<br><br><br />
<br />
<form name="form1" action="down.php" method="POST"> <br />
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%"><br />
<tr><br />
<td><FONT color=#000080 face=Arial size=2>Name *</FONT><br />
</td><br />
<td><INPUT type="text" name="Name" size=32><br />
</td><br />
</tr><br />
<TD><br />
<FONT color=#000080 face=Arial size=2>Country *</FONT><br />
</TD><br />
<TD><br />
<FONT color=#000080 face=Arial size=1><INPUT name=Country size=32><br />
</FONT><br />
</TD><br />
<br />
</tr><br />
<tr><br />
<td><br />
<FONT color=#000080 face=Arial size=2>E-mail *</FONT><br />
</td><br />
<td><INPUT name=Email size=32><br />
</td><br />
</tr><br />
<tr><br />
<td valign="top"><br />
<FONT color=#000080 face=Arial size=2>Phone *</FONT><br />
</td><br />
<td><INPUT name=Phone size=32><br />
</td><br />
</tr><tr><td><input type="button" name="btn" value="download" onClick="javascript:comprobadades()"> </td></tr></table></form><br />
</BODY><br />
</HTML><br />
now code of down.php
<?php<br />
<br />
if(isset($HTTP_POST_VARS["Name"])){ <br />
$Name = $HTTP_POST_VARS["Name"];<br />
} <br />
else{<br />
print("missing file name");<br />
exit;<br />
} <br />
if(isset($HTTP_POST_VARS["Country"])){ <br />
$Country = $HTTP_POST_VARS["Country"];<br />
} <br />
else{<br />
print("wrong country name");<br />
exit;<br />
<br />
} <br />
if(isset($HTTP_POST_VARS["Email"])){ <br />
$Email = $HTTP_POST_VARS["Email"]; <br />
} <br />
else{<br />
print("wrong Email-address");<br />
exit;<br />
} <br />
if(isset($HTTP_POST_VARS["Phone"])){ <br />
$Phone = $HTTP_POST_VARS["Phone"];<br />
} <br />
else{<br />
print("wrong phone number");<br />
exit;<br />
} <br />
<br />
$mailto = "alsoc@alsoc.org";<br />
$subject = "USDCHF pdf file download";<br />
$header = $header."From: alsoc@alsoc.org\n";<br />
<br />
$body = "Information\n";<br />
$body = $body."-----------\n";<br />
$body = $body."Name : ".$Name."\n";<br />
$body = $body."Country: ".$Country."\n";<br />
$body = $body."Email : ".$Email."\n";<br />
$body = $body."Phone : ".$Phone."\n";<br />
<br />
if(mail($mailto,$subject,$body,$header)) {<br />
echo "Mail is sent!";<br />
}<br />
else {<br />
echo "Mail could not be sent!";<br />
exit;<br />
}<br />
<br />
print "<br><br>";<br />
print("click here for start <a href=\"down2.php?file=usdjpy.pdf\">download</a>");<br />
<br />
<br />
$fp = fopen ("/alsoc.org/www/alsoc/php/oildatfile/oil.dat", "a+");<br />
fputs ($fp, "$Name\t$Country\t$Email\t$Phone\n");<br />
fclose($fp);<br />
<br />
?><br />
let me know is there any problem with these above code.
requried urgent help on this regards.
sujata.
|