473,246 Members | 3,294 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

Forms sending some blank emails

Hi, I'm validating a form with this ASP but receiving some blank email
responses; does anyone see anything wrong with it?:

function isFormVarExcluded(thisForm, strToCheck)
{
var strExcludeVars = thisForm.elements["$excludevars"].value;
var arrExcludeVars = strExcludeVars.split(",");
for (var j=0; j<arrExcludeVars.length; j++)
{
if (arrExcludeVars[j] == strToCheck) return true;
}
return false;
}

function getFormVars(thisForm)
{
var oFormVars = thisForm.elements["$formvars"];
var strPrevVal = "";
oFormVars.value = "";
for (var x=0,objElem=null; objElem=thisForm.elements.item(x); x++)
{
if (!isFormVarExcluded(thisForm, objElem.name))
{
if (objElem.name != strPrevVal)
oFormVars.value += objElem.name + ",";
}
strPrevVal = objElem.name;
}
oFormVars.value = oFormVars.value.substr(0,oFormVars.value.length-1);
}
Sep 29 '08 #1
2 3707
<ls********@softscape.comwrote in message
news:56**********************************@h2g2000h sg.googlegroups.com...
Hi, I'm validating a form with this ASP but receiving some blank email
responses; does anyone see anything wrong with it?:

function isFormVarExcluded(thisForm, strToCheck)
{
var strExcludeVars = thisForm.elements["$excludevars"].value;
var arrExcludeVars = strExcludeVars.split(",");
for (var j=0; j<arrExcludeVars.length; j++)
{
if (arrExcludeVars[j] == strToCheck) return true;
}
return false;
}

function getFormVars(thisForm)
{
var oFormVars = thisForm.elements["$formvars"];
var strPrevVal = "";
oFormVars.value = "";
for (var x=0,objElem=null; objElem=thisForm.elements.item(x); x++)
{
if (!isFormVarExcluded(thisForm, objElem.name))
{
if (objElem.name != strPrevVal)
oFormVars.value += objElem.name + ",";
}
strPrevVal = objElem.name;
}
oFormVars.value = oFormVars.value.substr(0,oFormVars.value.length-1);
}
I may as well ask the obvious; is this script on the server or the client?

There isn't anything in your supplied code relating directly to the sending
of e-mails (nor for that matter relating explicitly to server-side code).

How are you sending them? Have you tested for existence of content in the
relevant string(s) immediately prior to sending?

- Bob.
Sep 30 '08 #2
On Sep 29, 8:20*pm, "Bob Milutinovic" <cogni...@gmail.comwrote:
<lstanik...@softscape.comwrote in message

news:56**********************************@h2g2000h sg.googlegroups.com...


Hi, I'm validating a form with this ASP but receiving some blank email
responses; does anyone *see anything wrong with it?:
function isFormVarExcluded(thisForm, strToCheck)
{
var strExcludeVars = thisForm.elements["$excludevars"].value;
var arrExcludeVars = strExcludeVars.split(",");
for (var j=0; j<arrExcludeVars.length; j++)
{
if (arrExcludeVars[j] == strToCheck) return true;
}
return false;
}
function getFormVars(thisForm)
{
var oFormVars = thisForm.elements["$formvars"];
var strPrevVal = "";
oFormVars.value = "";
for (var x=0,objElem=null; objElem=thisForm.elements.item(x); x++)
{
if (!isFormVarExcluded(thisForm, objElem.name))
{
if (objElem.name != strPrevVal)
oFormVars.value += objElem.name * + ",";
}
strPrevVal = objElem.name;
}
oFormVars.value = oFormVars.value.substr(0,oFormVars.value.length-1);
}

I may as well ask the obvious; is this script on the server or the client?

There isn't anything in your supplied code relating directly to the sending
of e-mails (nor for that matter relating explicitly to server-side code).

How are you sending them? Have you tested for existence of content in the
relevant string(s) immediately prior to sending?

- Bob.- Hide quoted text -

- Show quoted text -
This is on the server. I didn't create it but it looks like a
validator script. The emails I receive (form responses) sometimes have
only []: in the body but some come in filled out properly (contact
info, product interest, etc.). There's also a validator in the HTML
form page:

<script language="javascript" type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var
i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain
an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a
number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
//-->
</script>

Then there's this in the form tag:

<form action="../../scripts/handleInfoRequest.asp" method="post"
name="info_request"
onSubmit="getFormVars(document.info_request);MM_va lidateForm('name','','R','phone','','R','email','' ,'RisEmail','state','','R');return
document.MM_returnValue">

which refers to this on the server:

<%@LANGUAGE = "JScript"%>
<%

function showError(description)
{
%>
<html>
<body>
<p>
ERROR: <%=description%>
</p>
</body>
</html>
<%
}

function showHelp()
{
%>
<html>
<body>
Available Parameters: toemail, fromemail, subject, content,
redirectto
</body>
</html>
<%
}

function getFormDataAsMsg(bUseHTML)
{
var dt = new Date();
var crlf = "\r\n";
if (bUseHTML) crlf = "<br>"

var strMailMsg = (dt.getMonth()+1) + "/" + dt.getDate() + "/" +
dt.getFullYear() +crlf;

var arrFormVars = new String(Request.Form("$formvars")).split(",");
for (i=0; i<arrFormVars.length; i++)
{
itemVal = new String(Request.Form(arrFormVars[i]));
if (bUseHTML)
{
if (itemVal != "undefined")
strMailMsg += "<b>[" + arrFormVars[i] + "]</b>:&nbsp;" + itemVal +
crlf;
else
strMailMsg += "<b>[" + arrFormVars[i] + "]</b>:&nbsp;" + crlf;
}
else
{
if (itemVal != "undefined")
strMailMsg += "[" + arrFormVars[i] + "]: " + itemVal + crlf;
else
strMailMsg += "[" + arrFormVars[i] + "]: " + crlf;
}
}
return strMailMsg;
}

function getFormDataAsCSV()

{
var strCSVLine = "";
var arrFormVars = new String(Request.Form("$formvars")).split(",");
for (i=0; i<arrFormVars.length; i++)
{
var itemVal = new String(Request.Form(arrFormVars[i]));
if (itemVal != "undefined")
{
var re1 = /\"/g;
var re2 = /\r\n/g;
var re3 = /\n/g;
strCSVLine += "\"" + itemVal.replace(re1, "'").replace(re2, "
").replace(re3, " ") + "\"";
}
else
strCSVLine += "\"\"";
if (i<arrFormVars.length-1) strCSVLine += ",";
}
return strCSVLine;
}
function appendToFile(strFileName, strContent)
{
if (strFileName == '' || strFileName == undefined) strFileName =
"default.txt";
strFileName = "d:/Web/WebDB/" + strFileName;

fs = new ActiveXObject("Scripting.FileSystemObject");

var bIsNewFile = false;
if (fs.FileExists(strFileName))
f = fs.GetFile(strFileName);
else
{
bIsNewFile = true;
fs.CreateTextFile(strFileName);
f = fs.GetFile(strFileName);
}

ts = f.OpenAsTextStream("8", "-2");
if (bIsNewFile)
{
ts.WriteLine(new String(Request.Form("$formvars")));
}
ts.WriteLine(strContent);
ts.Close( );
}

function sendMail(fromemail, toemail, subject, content)
{
var msg = new ActiveXObject("CDO.Message");
msg.From = fromemail;
msg.To = toemail;
msg.Subject = subject;
msg.TextBody = content;

Response.Write("*" + toemail);

msg.Configuration.Fields("http://schemas.microsoft.com/cdo/
configuration/smtpserver") = "10.0.4.9";
msg.Configuration.Fields("http://schemas.microsoft.com/cdo/
configuration/sendusing") = 2;
msg.Configuration.Fields.Update();
try
{
msg.Send();
}
catch(e)
{
showError("CDO.Message.Send() failed: " + e.description);
return false;
}
return true;
}

var strSubject = new String(Request.Form("$subject"));
var strToEmail = new String(Request.Form("$toemail"));
var strRedirectURL = new String(Request.Form("$redirectto"));
var strFileName = new String(Request.Form("$saveas"));

appendToFile(strFileName, getFormDataAsCSV());
if (sendMail("in**********@www.softscape.com", strToEmail, strSubject,
getFormDataAsMsg(false)))
Response.Redirect(strRedirectURL);
%>

Someone said it's a SPAM problem, but IT says there's no indication of
a SPAM problem in the headers of the blank emails.

Thanks much
Nov 11 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
2
by: Joe | last post by:
Hi, I am sending an email from an asp page. Besides sending an email to sender, I am sending myself a BCC also. Out of 100 emails sent, about 5 recipients received a blank email (no text in...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
3
by: Steve Thurston | last post by:
Hi, I'm attempting to send emails for the first time using ASP.NET, so I'm hoping there's just a beginner's error going on here for me. But my emails aren't reaching their destination, and I...
8
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and...
4
by: splicemix | last post by:
Hi all, I have recently set up a Drupal website. I am a beginner. My shared host server does not allow nobody@localhost to send emails, and prevents access to php.ini, so I spent some time...
5
by: Daves | last post by:
Hi, I'm using a asp.net 2.0 website to send out emails to users, the amount of which can reach up to 1500 users. Obviously the code sending the emails has to let the client know the mails are...
5
by: Kun | last post by:
i have the following code: ---------------------------------- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From =...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.