Forum Moderators: open
<form action="send_email.aspx" method="post" enctype="multipart/form-data" id="infoForm" name="infoForm" onsubmit="return validateForm();" >
<label class="requiredField">
<input type="hidden" class="DEPENDS ON os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt OR custO BEING lender OR custO BEING borrower OR custO BEING othr"/>
<span class="requiredField"><strong><em>*Required fields</em></strong></span></label>
<label id=genllbl> <input type="hidden" id="error_msg" name= "error_msg" /><strong>General Information</strong>
<input type="radio" name="os" id="genlOpt" value="genlOpt" onclick = "checkValue(infoForm)"/>
</label>
<label id=custlbl><strong> Customer Care</strong>
<input type="radio" name="os" id="custOpt" value="custOpt" onclick = "checkValue(infoForm)"/>
</label>
<label id=medialbl><strong> Media Kit</strong>
<input type="radio" name="os" id="mediaOpt" value="mediaOpt" onclick = "checkValue(infoForm)"/>
</label>
<strong>
<label id=careerlbl> Career Opportunities
<input type="radio" name="os" id="careerOpt" value="careerOpt" onclick = "checkValue(infoForm)"/>
</label> <br />
<label><strong>Are you a: Member Lender</strong><a href="#" class="hintanchor" onmouseover="showhint('A member of an organization that subscribes to and utilizes PayNet’s services.', this, event, '150px')">(?)</a>
<input id="lender" type="radio" name="custO" class="DEPENDS ON os BEING custOpt" value="lender" onclick="setSubj()"/>
</label>
<label><strong> Borrower</strong><a href="#" class="hintanchor" onmouseover="showhint('An organization or sole proprietor seeking financing from one of PayNet’s Member Lenders.', this, event, '150px')">(?)</a>
<input id="borrower" type="radio" name="custO" value="borrower" class="DEPENDS ON os BEING custOpt" onclick="setSubj()"/></label>
<label><strong> Other</strong><a href="#" class="hintanchor" onmouseover="showhint('An organization or sole proprietor that does not fit the profile of a Member Lender or a Borrower.', this, event, '150px')" >(?)</a><input id="othr" type="radio" name="custO" value="othr" class="DEPENDS ON os BEING custOpt" onclick="setSubj()"/></label>
<p>
<label><strong>Do you want a free copy of your PayNet Credit History Report? Yes</strong>
<input type="radio" name="chrRqst" class="DEPENDS ON custO BEING borrower" value="yes"/>
</label>
<label><strong> No</strong>
<input type="radio" name="chrRqst" value="no" class="DEPENDS ON custO BEING borrower"/></label>
</p>
<p>
<label><strong>How would you like to receive the report? By Email</strong>
<input type="radio" name="chrRec" class="DEPENDS ON chrRqst BEING yes" value="email"/>
</label>
<label><strong> By Fax</strong>
<input type="radio" name="chrRec" value="fax" class="DEPENDS ON chrRqst BEING yes" />
</label>
</p>
<p>
<label><input type='hidden' class="DEPENDS ON chrRec BEING email"/>
<em><strong>Please complete the form below <br />
OR <br />
If you would like to submit your request by email</strong>, please submit your request to: <a href="mailto:support@example.com">support@example.com</a><br />
Your company's email address must include the company's/organizations name as part of the domain name, such as mike@abccompany.com.
<br />
Please enter in the subject line of the email - "Request for Credit History Report";<br />
Please include in the body of your email: <br />
The company's/organization's full address including city and state;<br />
A contact person and phone number in case we have additional questions
</em></label>
</p>
<p>
<label><input type='hidden' class="DEPENDS ON chrRec BEING fax"/>
<em><strong>Please complete the form below <br />
OR <br />
If you would like to submit your request by fax</strong>, please submit your request on company letterhead and send your fax to: 847-965-9828, Attention:Support.<br />
Please include in the body of your fax:<br />
"Request for Credit History Report";<br />
The company's/organization's full address including city and state;<br />
A contact person and phone number in case we have additional questions;<br />
The fax number where you would like your Report sent
</em></label>
</p>
<p>
<label><strong>Would you like to download the Media Kit (PDF)?</strong>
<input name="medOpt" type="radio" class="DEPENDS ON os BEING mediaOpt" onclick="doredirect();" value="dwnld"/>
</label></p>
<p>
<label><strong>Or request a hard copy to be mailed to you?</strong>
<input name="medOpt" type="radio" class="DEPENDS ON os BEING mediaOpt" value="hrdCpy" onclick="setSubj()"/>
</label>
</p>
<label>
<input type="hidden" class="DEPENDS ON os BEING careerOpt"/>
<font color="#000099">
<strong><em>Contact Information:<br />
=================================================================<br />
</em></strong></font></label>
<p>
<label><strong> Company Name</strong>
<input name="cmpyName" type="text" class="DEPENDS ON os BEING genlOpt OR medOpt BEING hrdCpy OR custO BEING lender OR custO BEING borrower OR custO BEING othr" id="cmpyName" size="60" maxlength="60"/>
<br />
<br />
</label>
<label>
<span class="requiredField"><strong>*</strong></span><strong>First Name</strong>
<input name="firstName" type="text" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="firstName" value="" size="30" maxlength="30"/>
</label>
<label><span class="requiredField"><strong>*</strong></span><strong>Last Name</strong>
<input name="lastName" type="text" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="lastName" value="" size="30" maxlength="50"/>
</label>
<br />
</p>
<p>
<label><span class="requiredField"><strong>*</strong></span><strong>Address1 </strong>
<input name="add1" type="text" class="DEPENDS ON custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="add1" value="" size="50" maxlength="50"/>
</label>
</p>
<p>
<label><strong> Address2
</strong>
<input name="add2" type="text" class="DEPENDS ON custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="add2" value="" size="50" maxlength="50"/>
</label>
</p>
<p>
<label><span class="requiredField"><strong>*</strong></span><strong>Country:</strong> United States
<input type="radio" name="cntryO" value="US" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt"/>
</label>
<label>Canada<input type="radio" name="cntryO" value="CA" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt"/></label>
<br />
</p>
<p>
<label><span class="requiredField"><strong>*</strong></span><strong>City</strong>
<input name="addCity" type="text" class="DEPENDS ON os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt OR custO BEING othr" id="addCity" onfocus="valCountry(infoForm)" size="25" maxlength="25"/>
</label>
<label><span class="requiredField"><strong>*</strong></span><strong>Province</strong>
<select name="Province" id="Province" class="DEPENDS ON cntryO BEING CA AND os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt AND CONFLICTS WITH custO BEING lender">
<option value="">SELECT ONE</option>
<option value="AB">Alberta</option>
<option value="BC">British Columbia</option>
<option value="MB">Manitoba</option>
<option value="NB">New Brunswick</option>
<option value="NL">Newfoundland and Labrador</option>
<option value="NS">Nova Scotia</option>
<option value="NT">Northwest Territories</option>
<option value="NU">Nunavut</option>
<option value="ON">Ontario</option>
<option value="PE">Prince Edward Island</option>
<option value="QC">Quebec</option>
<option value="SK">Saskatchewan</option>
<option value="YT">Yukon</option>
</select>
</label>
<label><span class="requiredField"><strong>*</strong></span><strong>State</strong>
<select name="addState" id="addState" class="DEPENDS ON cntryO BEING US AND os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt AND CONFLICTS WITH custO BEING lender">
<option value="">SELECT ONE</option>
<option value='0' >Alabama</option>
<option value='1' >Alaska</option>
<option value='2' >Arizona</option>
<option value='3' >Arkansas</option>
<option value='4' >California</option>
<option value='5' >Colorado</option>
<option value='6' >Connecticut</option>
<option value='7' >Delaware</option>
<option value='8' >District of Columbia</option>
<option value='9' >Florida</option>
<option value='10' >Georgia</option>
<option value='11' >Hawaii</option>
<option value='12' >Idaho</option>
<option value='13' >Illinois</option>
<option value='14' >Indiana</option>
<option value='15' >Iowa</option>
<option value='16' >Kansas</option>
<option value='17' >Kentucky</option>
<option value='18' >Louisiana</option>
<option value='19' >Maine</option>
<option value='20' >Maryland</option>
<option value='21' >Massachusetts</option>
<option value='22' >Michigan</option>
<option value='23' >Minnesota</option>
<option value='24' >Mississippi</option>
<option value='25' >Missouri</option>
<option value='26' >Montana</option>
<option value='27' >Nebraska</option>
<option value='28' >Nevada</option>
<option value='29' >New Hampshire</option>
<option value='30' >New Jersey</option>
<option value='31' >New Mexico</option>
<option value='32' >New York</option>
<option value='33' >North Carolina</option>
<option value='34' >North Dakota</option>
<option value='35' >Ohio</option>
<option value='36' >Oklahoma</option>
<option value='37' >Oregon</option>
<option value='38' >Pennsylvania</option>
<option value='39' >Puerto Rico</option>
<option value='40' >Rhode Island</option>
<option value='41' >South Carolina</option>
<option value='42' >South Dakota</option>
<option value='43' >Tennessee</option>
<option value='44' >Texas</option>
<option value='45' >Utah</option>
<option value='46' >Vermont</option>
<option value='47' >Virginia</option>
<option value='48' >Washington</option>
<option value='49' >West Virginia</option>
<option value='50' >Wisconsin</option>
<option value='51' >Wyoming</option>
</select>
</label>
</p>
<p>
<label>
<span class="requiredField"><strong>*</strong></span><strong>Zip/Postal Code</strong>
<input name="addZip" type="text" class="DEPENDS ON custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="addZip" size="9" maxlength="9"/></label>
</p>
<p>
<label>
<strong> Bus Phone</strong>
<input name="busPhone" type="text" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="busPhone" size="10" maxlength="10"/>
</label>
<label><strong>Cell Phone</strong>
<input name="cellPhone" type="text" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="cellPhone" size="10" maxlength="10"/>
</label>
<label><strong>Home Phone</strong>
<input name="hmPhone" type="text" class="DEPENDS ON os BEING careerOpt" id="hmPhone" size="10" maxlength="10"/>
</label>
<br />
</p>
<p>
<label><strong> Fax</strong>
<input name="addFax" type="text" class="DEPENDS ON custO BEING lender OR chrRec BEING fax OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="addFax" size="12" maxlength="12"/>
</label>
<br />
</p>
<p>
<label><strong> Email</strong>
<input name="emailAdr" type="text" class="DEPENDS ON os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt OR custO BEING lender OR custO BEING othr OR chrRec BEING email" id="emailAdr" size="60" maxlength="60"/>
</label>
</p>
<label><span class="requiredField"><strong>*</strong></span><strong>Preferred method of contact</strong>
<select name="prefCnt" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" id="prefCnt" onfocus="valCntInfo()" >
<option value="">SELECT ONE</option>
<option value="bus">Business Phone</option>
<option value="cell">Cell/Mobile Phone</option>
<option value="home">Home Phone</option>
<option value="fax">Fax</option>
<option value="email">Email </option>
</select>
</label>
<label><strong>Best time to contact you
</strong>
<input type="text" name="conTime" id="conTime" class="DEPENDS ON os BEING careerOpt"/>
</label><br /><br />
<label>
<input type="hidden" class="DEPENDS ON os BEING careerOpt"/>
<font color="#000099">
<strong><em>Application Information:<br />
=================================================================</em></strong></font></label>
<label><strong><br />
<br />
Upload your Cover Letter</strong>
<input type="file" name="upCover" id="upCover" class="DEPENDS ON os BEING careerOpt"/>
</label>
<label><strong><br />
<em> OR</em></strong><br />
<strong> Copy and paste your Cover Letter</strong><br />
<textarea name="pstCvr" cols="50" rows="14" class="DEPENDS ON os BEING careerOpt" id="pstCvr"></textarea>
</label>
<p> <label><strong> Upload your Resume</strong>
<input type="file" name="upResume" id="upResume" class="DEPENDS ON os BEING careerOpt"/>
<br />
</label>
<label><strong><em> OR</em></strong><br />
<strong> Copy and paste your Resume</strong><br />
<textarea name="pstResume" cols="50" rows="14" class="DEPENDS ON os BEING careerOpt" id="pstResume"></textarea>
</label>
</p>
<div>
<label>
<select name="firstlevel" id="firstlevel" disabled="disabled" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" >
</select>
<strong><span class="requiredField">*</span></strong><strong>Subject Line</strong></label>
<select name="secondlevel" id="secondlevel" value="" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" onblur="check2nd();">
</select>
</div>
<label id=displayOthr style="visibility:hidden" ><strong><br />
<span class="requiredField">*</span><strong>Other Request Subject</strong>
<input name="subjOthr" type="text" id="subjOthr" size="60" maxlength="60" />
</label>
<label>
<strong><br />
<br />
What can we do for you? </strong>(max. 300 characters)<br />
<textarea name="comments" cols="60" rows="5" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy" id="comments" style="width:250px" onfocus="valCntInfo()"></textarea>
</label>
<label class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy">
<div id="comments-status" > </div>
</label>
<br />
<label><input type="reset" name="reset" id="reset" value="Reset" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt"/>
</label>
<label><input type="submit" name="Submit" id="Submit" value="Submit" class="DEPENDS ON custO BEING lender OR custO BEING borrower OR custO BEING othr OR os BEING genlOpt OR medOpt BEING hrdCpy OR os BEING careerOpt" />
</label>
</form>
[edited by: marcel at 8:31 am (utc) on Dec. 4, 2009]
[edit reason] examplified [/edit]
A good place to start with emailing in ASP.Net is here:
[systemnetmail.com...]
I would advise you to first start with a simple form as a test and then extend the functionality when you've got it working.
Will this send my form as it is?
You could try building a simple form in Visual Studio, and then send the email as follows:
//create the mail message
MailMessage mail = new MailMessage();//set the addresses
mail.From = new MailAddress("me@example.com");
mail.To.Add("you@example.com");//set the content
mail.Subject = "This is an email";
mail.Body = "Name " + txtName.Text;
mail.Body += "email " + txtEmail.Text;//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
where txtName and txtEmail are <asp:TextBox /> controls
<% @language=C# aspcompat=true %>
using System.Net.Mail;
<script runat=server>void send_email() {
System.Net.Mail.MailMessage email_msg = new System.Net.Mail.MailMessage();
email_msg.To = "vwilliams@example.com"; //strUserEmail;
email_msg.From = "support@example.com";
email_msg.Cc = "";
string str1 = "Reset password confirmation";
email_msg.Subject = str1;
email_msg.Body = "aje;;poipnmpgda" ;
System.Net.Mail.SmtpMail.SmtpServer = "mail.example.com";
System.Net.Mail.SmtpMail.Send(email_msg);
//
error_msg = "Email was sent.";
// Context.Response.Redirect ("confirm.aspx?UserName="+strUserEmail+"&action=ConfirmReset");*/
}
</script>
[edited by: marcel at 6:03 am (utc) on Dec. 4, 2009]
[edit reason] examplified [/edit]
XML Parsing Error: no element found
Location: http ://turkey/wwwcorp_phase2/root/send_email.aspx
Line Number 1, Column 1:
[edited by: marcel at 5:08 pm (utc) on Dec. 4, 2009]
[edit reason] delinked [/edit]
You could extract the values from what is posted to the send_emal.aspx page with Request["variableName"]; and adding them one by one to the body of your email.
But, you wouldn't really be using ASP.Net as it was intended.
Here is a good example from 4 guys from Rolla:
[4guysfromrolla.com...]
Thanks for the link. There is a wealth of information there.
At this point, I would just like to get the email working. As you can see, this is a complicated form. It would take a lot of time for me to convert it.
I have found that taking a step back and creating a new, simple page with only the basics helps me grasp how it all works. After that I attempt a more challenging conversion like the one you are facing.
Here is some code that should work:
send_email.aspx
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Net.Mail" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
//create the mail message
MailMessage mail = new MailMessage();//set the addresses
mail.From = new MailAddress("me@example.com");
mail.To.Add("you@example.com");//set the content
mail.Subject = "This is an email";
mail.Body = "Name " + Request["txtName"];
mail.Body += "email " + Request["txtEmal"];//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}
</script>
If you are using an asp:FileUpload control to upload attachments you can add them to your email as follows:
if (FileUpload1.HasFile)
{
string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
Attachment myAttachment = new Attachment(FileUpload1.FileContent, fileName);
myMailMessage.Attachments.Add(myAttachment);
}
Unfortunately, I am not using asp controls.
Otherwise you will need to upload the file manually, store it in a temporary location, and then attach the message:
myMailMessage.Attachments.Add(new Attachment(Server.MapPath("/TempUploads/uploadedfile.doc")));