Dear all,
I have some query? your help will be highly appreciated.
1) How to get progress bar? is it a default property of form or OS? Can it be shown on any event ?can coding be done for showing progress bar? I want ,by the time files is being coped on web server it should appear or say at the time of submission of form,progress bar should be shown to user to avoid any confusion.What are the condition when it can be shown.any relative topic link can be very helpful for understanding.
2)
https://10.12.1.20/email.asp?IsSubmi...&vsubject=test
Above is a URL, through which I want to run a form directly? I have made an email form through It I can send emails it is working fine .I want to make better use of it and use it to send mails from asp pages.but above URL is not working?please fix the mistake. I am attaching code of email.asp for your reference.
3) As I have written I want to use email.asp page for better manner, One of it may be sending mail with error description to myself when any error appear on any page.Problem is how to detect error on page,please write code for detecting any error on page during execution and how to catch the error description and it to me using email.asp (you can imagine that some error appear in email.asp page itself).
Regards
Om Prakash
Attached is email.asp
Code:
%@ Language=VBScript %>
<% option explicit %>
<HTML>
<HEAD>
<%
dim conn
dim ObjCom,strfile,filenamestr
Dim objUpload, lngLoop,filename,filename1
Dim tcc,tto,tbcc,tsubject,tmessage,tfrom
Dim oConfiguration
Dim oMessage
Dim oFields
Const cdoSendUsingPort = 2
%>
<script language="javascript">
function fn_submit()
{
if (document.forms[0].vto.value==null || document.forms[0].vto.value=="" )
{
alert ("to is empty ..");
document.forms[0].vto.focus();
return false;
}
else if (document.forms[0].vfrom.value==null || document.forms[0].vfrom.value=="" )
{
alert ("write your email address ..");
document.forms[0].vfrom.focus();
return false;
}
else if (document.forms[0].vsubject.value==null || document.forms[0].vsubject.value=="" )
{
alert ("Subject can't be empty...");
document.forms[0].vsubject.focus();
return false;
}
else
{
if(!validemail(document.forms[0].vto.value))
{
alert("You need to enter valid email adress in TO ");
document.forms[0].vto.focus();
return false;
}
if(!validemail(document.forms[0].vfrom.value))
{
alert("You need to enter valid email address in FROM");
document.forms[0].vfrom.focus();
return false;
}
document.forms[0].submit();
}
}
function validemail(str)
{
var strFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
if (strFilter.test(str))
{ return true; }
else
{ return false; }
}
</script>
<%
If Request.Form("IsSubmitted") <> "" Then
if Request.Form("fname")<>"" then
strfile = split(Request.Form("fname"),"\")
filenamestr = strfile(Ubound(strfile))
end if
tmessage = Request.Form("vmessage")
tto = Request.Form("vto")
tcc = Request.Form("vcc")
tbcc = Request.Form("vbcc")
tsubject = Request.Form("vsubject")
tfrom = Request.Form("vfrom")
Set oMessage = CreateObject("CDO.Message")
Set oConfiguration = CreateObject("CDO.Configuration")
Set oFields = oConfiguration.Fields
With oFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") _
= cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "**.**.1.1"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
= 100
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") _
= 10
'for priority
.Item("urn:schemas:mailheader:X-MSMail-Priority") = 0
.Update
End With
'Apply the settings to the message.
With oMessage
Set .Configuration = oConfiguration
.To = tto
.Bcc = tbcc
.CC = tcc
.From = tfrom
.Subject = tsubject
.HTMLBody = "<table border = 0 align =top cellspacing = 1 cellpadding = 1><tr><td><pre>" & tmessage &"</td></tr></pre></table>"
if Request.Form("fname")<>"" then
.AddAttachment "C:\temp\email\"& filenamestr
end if
.Send
End With
'Clean up variables.
Set oMessage = Nothing
Set oConfiguration = Nothing
Set oFields = Nothing
%>
<script language = "javascript">
alert("Mail Sent Sucessfully");
</script>
<%
End If
%>
</HEAD>
<BODY>
<form id="frmSendEmail" name="frmSendEmail" method="post" action=<%=request.servervariables("script_name")%>>
<table border = "0" align ="top" cellspacing = 1 cellpadding = 1 width = "80%">
<tr><td ALIGN=middle valign = top colspan =2> Send Email </td></tr>
<!--
<tr><td align=middle valign =top colspan=2><b>To prevent abuse, your IP Address (<%= Request.ServerVariables("http_host")%>)will be logged and recorded for this email message..</b></td></tr>
-->
<tr bgcolor="#eeeeee">
<td align = left rowspan = 6 width = "30%">Your email:<BR><input name = "vfrom" id = "vfrom"
style="WIDTH: 179px; HEIGHT: 22px" size=23> * <BR><%=now()%>(MM/DD/YYYY)</td></tr>
<tr bgcolor="#eeeeee">
<td ALIGN=left><STRONG>
To: <input name="vto" id="vto" style="WIDTH: 396px; HEIGHT: 22px" size=48></STRONG></td></tr>
<tr bgcolor="#eeeeee">
<td ALIGN=left><STRONG>
cc:</STRONG><input name="vcc" id="vcc" style="WIDTH: 396px; HEIGHT: 22px" size=49></td></tr>
<tr bgcolor="#eeeeee">
<td align=left><STRONG>
bcc:</STRONG><input name="vbcc" id="vbcc" style="WIDTH: 396px; HEIGHT: 22px" size=48> </td></tr>
<tr bgcolor="#eeeeee">
<td ALIGN=left valign = top><STRONG>
Subject:</STRONG><input name="vsubject" id="vsubject" style="WIDTH: 396px; HEIGHT: 22px" size=46></td></tr>
<tr bgcolor="#eeeeee">
<td align=left colspan=3><strong>Upload File:</strong><input name=fname style="WIDTH: 1px; HEIGHT: 1px"> <A href="#" onclick = " window.open('uploadTester.asp','preview','top=10,left=50,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=700,height=185')" >Upload Your File(One file Per Email)</a></td></tr>
<tr bgcolor="#eeeeee">
<td ALIGN=left colspan=2><STRONG>Your message:</STRONG> </td></tr>
<tr bgcolor="#eeeeee">
<td align = left colspan =2><TEXTAREA id=vmessage name=vmessage rows=5 cols=80></TEXTAREA></td></tr><br>
<tr bgcolor="#eeeeee"><td align=left colspan=2><input type="button" name="btnSubmit" id="btnSubmit"
value="Send Message" onclick = "fn_submit()" > </td></tr>
<tr bgcolor="white">
<td align = middle colspan=3><p><A href="JavaScript:onClick=window.close()">Close Window</A></p>
</td></tr>
</table>
<input type="hidden" value= "True" name="IsSubmitted" >
</form>
</BODY>
</HTML>
om prakash kumar