<%! String referer = ""; String actionURL = "/OcwWeb/jsp/feedback.jsp"; String[][] array_natureOfInquiry = { {"No Selection", " --- Select Inquiry Type --- "}, {"Technical", "Technical"}, {"Course content", "Course Content"}, {"Intellectual property", "Intellectual Property"}, {"Feedback", "Feedback"}, {"Other", "Other"} }; String[][] array_educationalRoles = { {"No Selection", " --- Select a Role --- "}, {"Alum", "MIT Alumnus/Alumna"}, {"Educator - College/University", "Educator - College/University"}, {"Educator - High School", "Educator - High School"}, {"Educator - Other", "Educator - Other"}, {"Student - College/University", "Student - College/University"}, {"Student - High School", "Student - High School"}, {"Student - Other", "Student - Other"}, {"Self Learner", "Self Learner"} }; String[] array_countries = {"No Selection", "United States", "United Kingdom", "Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia And Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos Islands", "Colombia", "Comoros", "Congo", "Congo, The Democratic Republic Of The", "Cook Islands", "Costa Rica", "Cote D'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equitorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia, The Republic Of The", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guernsey", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Heard Island And Mcdonald Islands", "Holy See (Vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic Of", "Iraq", "Ireland", "Isle Of Man", "Israel", "Italy", "Jamaica", "Japan", "Jersey", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic Of", "Korea, Republic Of", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macao", "Macedonia, The Former Yugoslav Republic", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States of", "Moldova", "Monaco", "Mongolia", "Montenegro", "Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherland Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Islands", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russia", "Rwanda", "Saint Barth\351lemy", "Saint Helena", "Saint Kitts and Nevis", "Saint Lucia", "Saint Martin", "Saint Pierre and Miquelon", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia And South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard And Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan", "Tajikistan", "Tanzania, United Republic Of", "Thailand", "Timor-Leste", "Togo", "Tokelau", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks And Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Virgin Islands, British", "Virgin Islands, U.S.", "Wallis And Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"}; private boolean isInvalidEmail(String email_address){ int atIndex = 0; int dotIndex = 0; // 1. There is exactly one '@' character in the address and that is neither // the first nor the last character // 2. There is at least one '.' character in the address after the '@' character // and that is not the last character if (((atIndex = email_address.indexOf("@")) < 1) || ((dotIndex = email_address.indexOf(".", atIndex)) == -1) || (atIndex != email_address.lastIndexOf("@")) || (email_address.lastIndexOf(".") == email_address.length())) { return true; } else { return false; } } private int checkInputErrors( String email_address, String educational_role, String geographic_region, String nature_of_inquiry, String comments) { int error_code = 0; // no-error error_code += ((email_address == null) || email_address.trim().equals(""))? 1: (isInvalidEmail(email_address)? 2: 0); error_code += ((educational_role == null) || educational_role.trim().equals(""))? 4: 0; error_code += ((geographic_region == null) || geographic_region.trim().equals(""))? 8: 0; error_code += ((nature_of_inquiry == null) || nature_of_inquiry.trim().equals(""))? 16: 0; error_code += ((comments == null) || comments.trim().equals(""))? 32: 0; return error_code; } private void printErrors(int errorCode, javax.servlet.jsp.JspWriter out){ boolean emailBlank = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean emailFormatInvalid = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean eduRoleBlank = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean geoRegionBlank = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean natureOfInquiryBlank = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean commentsBlank = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; boolean otherError = (errorCode % 2 > 0)? true: false; errorCode = errorCode / 2; try{ if(emailBlank){ out.print("

Please enter your email address.

\n"); } else if(emailFormatInvalid){ out.print("

Please enter a valid email address.

\n"); } if(eduRoleBlank){ out.print("

Please enter your educational role.

\n"); } if(geoRegionBlank){ out.print("

Please enter your geographic region.

\n"); } if(natureOfInquiryBlank){ out.print("

Please select your nature of inquiry.

\n"); } if(commentsBlank){ out.print("

Please enter your comments.

\n"); } if(otherError){ out.print("

We are sorry for the inconvenience, but we are experiencing technical difficulty. Please try again later.

\n"); } } catch(Exception e){ return; } return; } private boolean sendFeedback( String firstName, String lastName, String fromAddress, String educationalRole, String geographicRegion, String inquiryType, String description, String referer) { // Address to which user input is sent final String TO_ADDRESS = "ocw@MIT.EDU"; // Address from which user input is shown as orignating from final String SOURCE_ADDRESS = "ocw@MIT.EDU"; // Subject of the e-mail that will be sent String subject = inquiryType; StringBuffer message = new StringBuffer(256); String course = ""; if (referer != null) { course = referer.replace('/', java.io.File.separatorChar); } if (!course.equals("")) { message.append("Refering URL: " + course); message.append("\n\n"); } message.append("Name: ").append(firstName).append(" ").append(lastName); message.append("\n\nE-mail: ").append(fromAddress); message.append("\n\nNature of Inquiry: ").append(inquiryType); message.append("\n\nEducational Role: ").append(educationalRole); message.append("\n\nGeographic Region: ").append(geographicRegion); message.append("\n\nDescription:\n").append(description).append("\n"); String toAddresses[] = new String[1]; toAddresses[0] = TO_ADDRESS; String fromAddresses[] = new String [1]; fromAddresses[0] = fromAddress; String softReplyMessage = "Thank you for your correspondence about MIT OpenCourseWare. If your message requires a response, we will contact you within 48 hours. \n\nPlease do not reply to this system-generated response. \n\n\nFor help with technical issues, please visit our Help section: \nhttp://ocw.mit.edu/OcwWeb/web/help/faq4/index.htm \n\nLearn more about the OpenCourseWare movement: \nhttp://www.ocwconsortium.org \n\nReceive updates and news about MIT OpenCourseWare: \nNewsletter: http://ocw.mit.edu/OcwWeb/jsp/subscribe.jsp \nRSS feeds: http://ocw.mit.edu/OcwWeb/web/about/rss/index.htm \n\nMake a donation to MIT OpenCourseWare: \nhttp://ocw.mit.edu/donate"; String softReplySubject = "Thank you for your OCW feedback"; try { com.mit.ocw.notifier.OcwNotifier.sendMessage(SOURCE_ADDRESS, toAddresses, null, null, subject, message.toString()); try { com.mit.ocw.notifier.OcwNotifier.sendMessage(SOURCE_ADDRESS,fromAddresses,null,null,softReplySubject,softReplyMessage); } catch (Throwable e) { // } } catch (Throwable e) { return false; } return true; } %> Free Online MIT Course Materials | Feedback | MIT OpenCourseWare

Contact Us

<% //--------------------- String firstName = ""; String lastName = ""; String fromEmail = ""; String eduRole = ""; String geoRegion = ""; String natureOfEnquiry = ""; String comments = ""; if(request.getMethod().equals("POST")){ referer = request.getParameter("Referer"); } else { if(session.getAttribute("fromPage") == null){ referer = (request.getHeader("Referer") == null)? "http://ocw.mit.edu/OcwWeb/web/home/home/index.htm": request.getHeader("Referer"); } else { referer = session.getAttribute("fromPage").toString(); } } if(request.getMethod().equals("POST")){ firstName = (request.getParameter("firstname") == null)? "": request.getParameter("firstname"); lastName = (request.getParameter("lastname") == null)? "": request.getParameter("lastname"); fromEmail = (request.getParameter("fromemail") == null)? "": request.getParameter("fromemail"); eduRole = ((request.getParameter("educationalRole") == null) || (request.getParameter("educationalRole").equals("No Selection")))? "": request.getParameter("educationalRole"); geoRegion = ((request.getParameter("geographicRegion") == null) || (request.getParameter("geographicRegion").equals("No Selection")))? "": request.getParameter("geographicRegion"); natureOfEnquiry = ((request.getParameter("inquiry") == null) || (request.getParameter("inquiry").equals("No Selection")))? "": request.getParameter("inquiry"); comments = (request.getParameter("description") == null)? "": request.getParameter("description"); int errorCode = checkInputErrors(fromEmail, eduRole, geoRegion, natureOfEnquiry, comments); session.setAttribute("fromPage", referer); if(errorCode > 0){ session.setAttribute("fname", firstName); session.setAttribute("lname", lastName); session.setAttribute("email", fromEmail); session.setAttribute("role", eduRole); session.setAttribute("region", geoRegion); session.setAttribute("inquirynature", natureOfEnquiry); session.setAttribute("feedbacktext", comments); response.sendRedirect(actionURL + "?result=error&errorcode=" + errorCode); } else { boolean sent = sendFeedback(firstName, lastName, fromEmail, eduRole, geoRegion, natureOfEnquiry, comments, referer); if(sent){ response.sendRedirect(actionURL + "?result=success"); } else { response.sendRedirect(actionURL + "?result=error&errorcode=" + 128); } } } boolean showErrors = false; boolean showSuccess = false; boolean showForm = true; int errorCode = 0; if(request.getParameter("result") != null){ showSuccess = (request.getParameter("result").equals("success"))? true: false; showForm = (!showSuccess); if(request.getParameter("result").equals("error")){ firstName = session.getAttribute("fname").toString(); lastName = session.getAttribute("lname").toString(); fromEmail = session.getAttribute("email").toString(); eduRole = session.getAttribute("role").toString(); geoRegion = session.getAttribute("region").toString(); natureOfEnquiry = session.getAttribute("inquirynature").toString(); comments = session.getAttribute("feedbacktext").toString(); //reset session variables session.setAttribute("fname", ""); session.setAttribute("lname", ""); session.setAttribute("email", ""); session.setAttribute("role", ""); session.setAttribute("region", ""); session.setAttribute("inquirynature", ""); session.setAttribute("feedbacktext", ""); } if(request.getParameter("errorcode") != null){ errorCode = Integer.parseInt(request.getParameter("errorcode")); showErrors = (errorCode > 0)? true: false; } } %> <% if(showSuccess){ session.setAttribute("fromPage", null); %>

We appreciate your feedback. An automatic confirmation message will be e-mailed now, and more specific information - if needed - will follow within two business days.



Return to referring page

<% } %> <% if(showForm){ %>

Please read our frequently asked questions for answers to common questions including:

How do I register?

Can I get credit or a certificate after completing these courses?

How can I download a zipped course?

How can I download the videos?

<% if(showErrors){ printErrors(errorCode, out); } %>

MIT OpenCourseWare will never share your e-mail address with a third party. For more about our serious regard for your privacy, please read our privacy policy.

<% } %>