/    Sign up×
Community /Pin to ProfileBookmark

HTML form not sending e-mail

Hi all,

I was wondering if someone could help me out.

I have an HTML form that needs to send a .MT file to the customer’s e-mail address that would be specified on the form. Is there a way to do this? Here is the code I have so far:

[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>— —– Service Mailbox</title>
<style type=”text/css”>
.header {
font-family: Verdana, Geneva, sans-serif;
size:inherit;
font-size: xx-large;
}
form {
font-family: “Trebuchet MS”, Arial, Helvetica, sans-serif;
}
</style>
<script
language=”JavaScript” type=”text/javascript”>
// Page Script Goes Here!

function checkCR(evt) {

var evt = (evt) ? evt : ((event) ? event : null);

var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

if ((evt.keyCode == 13) && (node.type==”text”)) {return false;}

}

document.onkeypress = checkCR;

function LimitText(fieldObj,maxChars)
{
var result = true;
if (fieldObj.value.length >= maxChars)
result = false;
}

function SubmitDate()
{
TDate = new Date();
CurMonth = TDate.getMonth() + 1;
if (CurMonth < 10)
{
CurMonth = ‘0’ + CurMonth;
}
CurDay = TDate.getDate();
if (CurDay < 10)
{
CurDay = ‘0’ + CurDay;
}
CurYear = TDate.getFullYear();
SDate = CurMonth + ‘/’ + CurDay + ‘/’ + CurYear;
document.Non_Par_Form.submission_date.value = SDate;
document.Non_Par_Form.date_of_submission.value = SDate;
}

function DefaultFocus()
{
document.Non_Par_Form.submitter_name.focus();
}

function y2k(number)
{
return (number < 1000) ? number + 1900 : number;
}

function Non_Par_Form_Validator(theForm)
{
if (theForm.id.value.length < 10)
{
alert(“Please enter at least 10 numbers in the —- ID field.”);
theForm.id.focus();
return (false);
}

// Check to make sure the all 10 characters in the contact ID # are numeric
var strValidChars = “0123456789”;
var strChar;
var blnResult = true;
for (i = 1; i < theForm.id.value.length && blnResult == true; i++)
{
strChar = theForm.id.value.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
alert(“—- ID should contain a minimum of 10 digits without letters. Please enter a valid —- ID #.”);
theForm.id.focus();
return (false);
}
}

if (theForm.email.value == “”)
{
alert(“Please enter —–s Email address.”);
theForm.email.focus();
return (false);
}

if (theForm.AID.value.length < 7)
{
alert(“Please enter 7 characters in the — ID # field.”);
theForm.AID.focus();
return (false);
}

// Check for an alpha character as the 1st character in the A#
var strValidChars = “AaNn”;
var strChar;
strChar = theForm.AID.value.charAt(0);
if (strValidChars.indexOf(strChar) == -1)
{
alert(“Please enter a valid — ID #.”);
theForm.AID.focus();
return (false);
}

// Check to make sure the last 6 characters in the # are numeric
var strValidChars = “0123456789”;
var strChar;
var blnResult = true;
for (i = 1; i < theForm.AID.value.length && blnResult == true; i++)
{
strChar = theForm.AID.value.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
alert(“Please enter a valid — ID #.”);
theForm.AID.focus();
return (false);
}
}

if (theForm.sc.value == “”)
{
alert(“Please select a value for the “Your Location” field.”);
theForm.sc.focus();
return (false);
}

//Select Appropriate Mailbox

if (theForm.sc.value == ‘System’)
{
theForm.send_mailbox.value = “email@—.com”;
}

if (theForm.sc.value == ‘Jerry’)
{
theForm.send_mailbox.value = “[email protected]”;
}

if (theForm.sc.value == ‘n/a’)
{
theForm.send_mailbox.value = “”;
}

// Double-check to make sure the submission date = the current date.
TDate = new Date();
CurMonth = TDate.getMonth() + 1;
if (CurMonth < 10)
{
CurMonth = ‘0’ + CurMonth;
}
CurDay = TDate.getDate();
if (CurDay < 10)
{
CurDay = ‘0’ + CurDay;
}
CurYear = TDate.getFullYear();
SDate = CurMonth + ‘/’ + CurDay + ‘/’ + CurYear;

// If the submission date <> the current date, set it equal to the current date.
// This should only occur if for some reason the field did not auto-populate with the current date per SubmitDate function above.
if (theForm.submission_date.value != SDate)
{
theForm.submission_date.value = SDate;
theForm.date_of_submission.value = SDate;
}
// End submission date double-check

// Set To From & Subject fields
theForm.to.value = theForm.email.value;
theForm.from.value = theForm.send_mailbox.value;
theForm.subject.value = ” Response to Your Request”;
theForm.bcc.value = theForm.send_mailbox.value;

return (true)
}

// –>
</script>
</head>

<body>
<p><img src=”envelope.jpg” alt=”” width=”150″ height=”150″ /><strong><span class=”header”> — —– Service Mailbox
</span>
</strong></p>
<p>&nbsp;</p>
<form action=”” enctype=”multipart/form-data” method=”post” name=”Non_Par_Form” onReset=”setTimeout(‘SubmitDate()’,100); HideOrDisplayRows(‘Select One’);” onSubmit=”return Non_Par_Form_Validator(this)”>
<input type=”hidden” name=”from” value>
<input type=”hidden” name=”to” value>
<input type=”hidden” name=”bcc” value>
<input type=”hidden” name=”mailmsg_template” value=”msm_template.mt”>
<input type=”hidden” name=”required” value=”email|email”>
<input type=”hidden” name=”required” value=”id|id”>
<input type=”hidden” name=”required” value=”AID|AID”>
<input type=”hidden” name=”html_success_template” value=”thanks.htm”>
<input type=”hidden” name=”subject” value>
<input type=”hidden” name=”send_mailbox” value>
<input type=”hidden” name=”date_of_submission” value>
<input type=”hidden” name=”html_genlerr_template” value=”mailfail.tmpl” />
<p>&nbsp;</p>
<p>
<label for=”submission_date”></label>
Submission date:
<label for=”submission_date2″></label>
<input name=”submission_date” type=”text” disabled=”disabled” id=”submission_date2″ />
</p>
<p>Location:
<label for=”sc”></label>
<select name=”sc” id=”sc”>
<option value=”— —– Services”>— —– Services</option>
<option value=”Jerry”>Jerry</option>
<option value=”system”>System</option>
</select>
</p>
<p>—–‘s E-mail Address
<label for=”email”></label>
<input type=”text” name=”email” id=”email” />
</p>
<p>— —– ID #
<label for=”id”></label>
<input name=”id” type=”text” id=”id” size=”10″ maxlength=”10″ />
</p>
<p>Your — Number
<label for=”AID”></label>
<input name=”AID” type=”text” id=”AID” size=”7″ maxlength=”7″ />
</p>
<p>Printer Friendly URL Address
<label for=”url”></label>
<input type=”text” name=”url” id=”url” />
</p>
<p>File attachments (.TIF files only) </p>
<p>
<label for=”att_1″></label>
<input type=”file” name=”att_1″ id=”att_1″ />
<br />
<label for=”att_2″></label>
<input type=”file” name=”att_2″ id=”att_2″ />
<br />
<label for=”att_3″></label>
<input type=”file” name=”att_3″ id=”att_3″ />
</p>
<p>
<input type=”submit” name=”button” id=”button” value=”Submit” />
<br />
</p>
</form>
<p>&nbsp;</p>
</body>
</html>[/CODE]

We have another form like this that in the ‘form action’ tag it uses a .TMPL file but I have no idea how they have that linked or how those work.

Thanks for any help!

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweySep 16.2012 — HTML and JavaScript/AJAX are incapable of sending files by Email. You need some software on your website to accomplish this. Search on "formmail attachments" and you should find several scripts that will help.
×

Success!

Help @JeRz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...