15,907,149 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by kinahp (Top 9 by date)
kinahp
24-Mar-15 6:35am
View
It works !!! Thank you so much for your help :)
kinahp
20-Mar-15 9:48am
View
$val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
mail( "email@email.com", $_POST['subject'], $_POST['message'], "From:" . $_POST['email']);
}
?>
Currently this is working fine apart phone number
kinahp
20-Mar-15 6:54am
View
doesn't show any error, but not even receiving any email if I add this
kinahp
20-Mar-15 5:29am
View
thank you ramyajaya, but it doesn't work either
kinahp
19-Mar-15 9:31am
View
sorry,didn't get that
kinahp
19-Mar-15 9:16am
View
Deleted
also need to clear up form when i submit the button, currently it's stays the data
kinahp
19-Mar-15 9:14am
View
done like this, got email but havent got any message in the body
= 5.2.0
if ( isset($_POST['email']) && isset($_POST['name']) && isset($_POST['subject']) && isset($_POST['message']) && isset($_POST['phonenumber']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ) {
// detect & prevent header injections
$test = "/(content-type|bcc:|cc:|to:)/i";
foreach ( $_POST as $key => $val ) {
if ( preg_match( $test, $val ) ) {
exit;
}
}
$MESSAGE_BODY = "Name: ".$_POST["name"]."\n";
$MESSAGE_BODY .= "Contact No: ".$_POST["phonenumber"]."\n";
$MESSAGE_BODY .= "Message: ".nl2br($_POST["message"])."\n";
$message = $_REQUEST['name' + 'phonenumber' + 'message'] ;
//
mail( "youremail@email.com", $_POST['subject'], $_POST['MESSAGE_BODY'], "From:" . $_POST['email']);
}
?>
kinahp
19-Mar-15 8:46am
View
submit function
$("#contact-form").submit(function (e) {
e.preventDefault();
var name = $("#name").val();
var email = $("#email").val();
var subject = $("#subject").val();
var message = $("#message").val();
var phonenumber = $("#phonenumber").val();
var dataString = 'name=' + name + '&email=' + email + '&subject=' + subject + '&message=' + message + '&phonenumber=' + phonenumber;
function isValidEmail(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
return pattern.test(emailAddress);
};
if (isValidEmail(email) && (message.length > 1) && (name.length > 1)) {
$.ajax({
type: "POST",
url: "../sendmail.php",
data: dataString,
success: function () {
$('.success').fadeIn(1000);
$('.error').fadeOut(500);
}
});
} else {
$('.error').fadeIn(1000);
$('.success').fadeOut(500);
}
return false;
});
want to add phone number on email message when user fills up on contact form
kinahp
19-Mar-15 8:38am
View
want to add on message but when i add like this its not even going email ,
mail( "myemail@email.com", $_POST['subject'], $_POST['message'], "From:" . $_POST['email'],$_POST['phonenumber']);
i have no idea where to add
Show More