# Email firing from a page

**URL:** <https://forum.kirupa.com/t/email-firing-from-a-page/206243>\
**Category:** Uncategorized\
**Created:** [November 6, 2006, 3:37pm UTC](https://forum.kirupa.com/t/email-firing-from-a-page/206243 "2006-11-06T15:37:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bloodandwater](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@bloodandwater](https://forum.kirupa.com/u/bloodandwater)\
**Post date:** [November 6, 2006, 3:37pm UTC](https://forum.kirupa.com/t/email-firing-from-a-page/206243/1 "2006-11-06T15:37:04Z")

</div>

hello friends i have prepared a contact us page which is made in flash… i have used an aspx page to throw an email to a particular id. but i want it to be fired from flash. here’s the code… plz help me…

Selection.setFocus(“fname”);  
var sending:LoadVars = new LoadVars();  
this.fname.tabIndex = 1;  
this.lname.tabIndex = 2;  
this.compname.tabIndex = 3;  
this.posi.tabIndex = 4;  
this.address.tabIndex = 5;  
this.city.tabIndex = 6;  
this.stat.tabIndex = 7;  
this.phone.tabIndex = 8;  
this.e\_mail.tabIndex = 9;  
this.messag.tabIndex = 10;  
this.submit\_btn.tabIndex = 11;  
this.tour\_btn.tabIndex = 12;  
this.submit\_btn.onRelease = function() {  
\_root.sending.address = \_root.address.text;  
\_root.sending.city = \_root.city.text;  
\_root.sending.email = unescape(\_root.e\_mail.text);  
\_root.sending.fname = \_root.fname.text;  
\_root.sending.lname = \_root.lname.text;  
\_root.sending.company = \_root.compname.text;  
\_root.sending.position = \_root.posi.text;  
\_root.sending.messag = \_root.messag.text;  
\_root.sending.phone = \_root.phone.text;  
\_root.sending.stat = \_root.stat.text;  
if ((\_root.e\_mail.text == “”) or (\_root.e\_mail.text == null)) {  
\_root.errpo.text = “Please fill in all the fields !!!”;  
} else if ((\_root.lname.text == “”) or (\_root.lname.text == null) or (\_root.fname.text == “”) or (\_root.fname.text == null) or (\_root.address.text == “”) or (\_root.address.text == null)) {  
\_root.errpo.text = “Please fill in all the fields !!!”;  
} else if ((\_root.city.text == “”) or (\_root.city.text == null) or (\_root.stat.text == “”) or (\_root.stat.text == null) or (\_root.phone.text == “”) or (\_root.phone.text == null)) {  
\_root.errpo.text = “Please fill in all the fields !!!”;  
} else if ((\_root.messag.text == “”) or (\_root.messag.text == null)) {  
\_root.errpo.text = “Please fill in all the fields !!!”;  
} else if ((\_root.compname.text == “”) or (\_root.compname.text == null) or (\_root.posi.text == null) or (\_root.posi.text == null)) {  
\_root.errpo.text = “Please fill in all the fields !!!”;  
}else {  
var mailcheck:String = \_root.e\_mail.text;  
var domaincheck:String = new String();  
var fpart:Array = new Array();  
var lpart:Array = new Array();  
fpart = mailcheck.split("@");  
//trace(fpart);  
if (fpart.length == 2) {  
var atTrue:Boolean = true;  
domaincheck = String(fpart[1]);  
lpart = domaincheck.split(".");  
//trace(lpart);  
if (lpart.length\>=2) {  
var dotTrue:Boolean = true;  
}  
}  
if (atTrue == true and dotTrue == true) {  
\_root.address.text="";  
\_root.city.text="";  
\_root.compname.text="";  
\_root.e\_mail.text="";  
\_root.errpo.text="";  
\_root.fname.text="";  
\_root.lname.text="";  
\_root.messag.text="";  
\_root.phone.text="";  
\_root.posi.text="";  
\_root.stat.text="";  
\_root.sending.send(“c\_submit.aspx”, “\_self”, “POST”);  
gotoAndStop(2);  
} else {  
\_root.errpo.text = “Please give a valid e-mail address.”;  
}  
}  
};  
this.tour\_btn.onRelease=function(){  
getURL(“tour1.aspx”,"\_self");  
}  
var someListener:Object = new Object();  
someListener.onSetFocus = function(oldFocus, newFocus) {  
if (newFocus == \_root.phone) {  
\_root.phone.text = “”;  
\_root.validPhone = false;  
}  
if (oldFocus == \_root.phone) {  
//if (isNaN(\_root.phone.text)) {  
\_root.errpo.text = “Please enter numbers in phone field”;  
//} else {  
\_root.phone.text = reformatUSPhone();  
//}  
}  
};  
Selection.addListener(someListener);  
function reformat() {  
var s = validator();  
if (s.length\>=10) {  
var arg;  
var sPos = 0;  
var resultString = “”;  
for (var i = 0; i\<arguments.length; i++) {

arg = arguments\*;  
if (i%2 != 1) {  
resultString += arg;  
} else {  
resultString += s.substring(sPos, sPos+arg);  
sPos += arg;  
}  
}  
\_root.validPhone = true;  
\_root.errpo.text = “”;  
return resultString;  
}  
return s;  
\_root.errpo.text = “Please enter a valid phone number”;  
}  
function reformatUSPhone() {  
//Reformats as (123)456-789.  
return (this.reformat("(", 3, “) “, 3, “-”, 4));  
}  
function validator() {  
var phno:String = new String();  
phno = \_root.phone.text;  
var my\_arr:Array = new Array();  
var ph\_arr:Array = new Array();  
my\_arr = phno.split(””);  
var count:Number = new Number();  
count = 0;  
for (i=0; i\<my\_arr.length; i++) {  
if (isNaN(my\_arr\*) == false) {  
ph\_arr[count] = my\_arr\*;  
count++;  
}  
}  
phno = “”;  
for (j=0; j\<ph\_arr.length; j++) {  
phno += String(ph\_arr[j]);  
}  
return (phno);  
}
