- This topic is empty.
-
AuthorPosts
-
May 12, 2014 at 12:46 am #169843
Moorthi
Participanti create a form for web paging and working the validation. but can’t sending the mail
May 12, 2014 at 10:00 am #169896shaneisme
ParticipantYou would use the
mail()
method. It might take some setup though.LMGTFY:
http://php.net/manual/en/function.mail.php
http://stackoverflow.com/questions/5335273/how-to-send-an-email-using-php
https://css-tricks.com/sending-nice-html-email-with-php/May 12, 2014 at 11:52 am #169920__
Participantbut can’t sending the mail
Any time you want to ask for help, make sure you:
- describe your problem, in specific terms.
- what did you try to do, and what did you expect to happen?
- what actually happened?
- share your code, specifically, the part where the problem is.
Telling us “it doesn’t work,” or similarly vague complaints, is completely useless. First, it’s obvious: if your code were working, you wouldn’t be asking for help, right? Be descriptive, be specific, give examples.
May 12, 2014 at 9:56 pm #169968Moorthi
Participanti ll try this mail function..but not sending via local host
May 12, 2014 at 11:18 pm #169972__
Participanti ll try this mail function..but not sending via local host
Do you have a mail server running on your local machine?
mail
simply submits an email to a mail server —it isn’t a mail server itself. If you don’t have a mail server, it cannot work.May 13, 2014 at 4:49 am #170004Moorthi
Participanttraq.,
how to get the mail server for windows xp.May 13, 2014 at 4:51 am #170005Moorthi
Participantwhen i submit the form to display for php code in a web page.does not accessing the code.
May 13, 2014 at 7:46 am #170019Taufik Nurrohman
ParticipantJust make sure you create a proper email header:
$header = "From: " . $_POST['email'] . " \r\n"; $header .= "Reply-To: " . $_POST['email'] . " \r\n"; $header .= "Return-Path: " . $_POST['email'] . " \r\n"; $header .= "X-Mailer: PHP \r\n"; mail('[email protected]', 'Inbox!', 'Test message.', $header);
Guide and reasons: http://www.html-form-guide.com/email-form/php-script-not-sending-email.html
May 13, 2014 at 10:30 am #170037__
Participanthow to get the mail server for windows xp.
there are many options.
Honestly, setting up an email server is beyond the scope of a forum discussion.You can either spend a few days/weeks studying and then try it yourself (this is the stage where, if/when you have specific problems, it would be appropriate to ask on a discussion board), or —if it is important/ time-sensitive— you could hire someone who already knows how to do it.
when i submit the form to display for php code in a web page.does not accessing the code.
I do not understand what you mean by this. What do you want to display? what “code” do you want to access? what are you doing to try to achieve this? what is actually happening when you try?
Please be specific, and describe each item clearly, individually, in its own sentence.
Just make sure you create a proper email header […]
http://www.html-form-guide.com/email-form/php-script-not-sending-email.htmlThat article does a pretty good job of describing how to troubleshoot emails, and of how various headers should be configured.
However, it (and your example code) introduces header injection vulnerabilities, which could turn your website into a spam server.
For example:
$header .= "Reply-To: " . $_POST['email'] . " \r\n";
Never Trust User Input.
$_POST['email']
is supposed to be a single email address, but it could be anything. What if it is a list of hundreds of email addresses? or what if it contains an\r\n
, followed by more headers, which you never intended to add? what if it contains an email attachment? a virus?If that happens, then this approach will simply allow it to happen. You can get your email server blacklisted. You can lose your webhost account. It’s very hard (i.e., usually impossible) to prove who actually does things like this, but make no mistake, you will be the one who has to deal with the consequences. You might even be held responsible by your web host.
Always Validate and Sanitize User Input. In this case,
$_POST['email']
is supposed to be a single email address, so make sure it is a single email address:$userEmail = filter_var( $_POST['email'],FILTER_VALIDATE_EMAIL ); if( ! $userEmail ){ /* $_POST['email'] was not a valid email. stop! */ }
May 13, 2014 at 9:09 pm #170120Moorthi
ParticipantName:
Your Email Address:Message:
submit
i need code for mail function
May 13, 2014 at 11:56 pm #170136__
Participanti need code for mail function
You have two options:
- try, and then ask questions when you need help with a specific problem. I (and likely others as well) will be happy to help.
- hire someone to do it for you.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.