Add "\n\r" after $fromEmail.
Find
Replace withPHP Code:mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail);
PHP Code:mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail . "\n\r");
Add "\n\r" after $fromEmail.
Find
Replace withPHP Code:mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail);
PHP Code:mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail . "\n\r");
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
Why need "\n\r" after $fromEmail ?
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/stefin/contact.php
Code:<?php if (isset($_POST['submit'])) { $fromEmail = $_POST['fromEmail']; $body = $_POST['body']; mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail . "\n\r"); echo 'Thank you for contacting us.'; } else { echo '<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Contact Us</title> </head> <body> <form action="contact.php" method="POST"> Email<br> <input type="text" name="fromEmail"><br> Message<br> <textarea name="body" cols="30" rows="10"></textarea> <br> <button type="submit" name="submit" value="submit">Send Mail</button></form> </body></html> ';}
Very nice script :)
If [email protected] is not your email address, it is better change it. If not if some one submit that form, we will mail the content to [email protected], that will be like sending spam.. as he don't want us to send him such mails.
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/annie/form.phpCode:<?php if (isset($_POST['submit'])) { $formEmail = $_POST['formEmail']; $body = $_POST['body']; mail('[email protected]', 'Message from Skype', $body , 'From: ' . $fromEmail . "\n\r"); echo 'Thanks for Contacting us'; } else { echo '<!doctype html> <html lang="en"> <head> <meta charset = "UTF-8"> <title> Contact Us </title> </head> <body> <form action= "form.php" method="POST"> Email <br> <input type="text" name="fromEmail"> <br> Message <br> <textarea name="body" cols="30" rows="10"></textarea> <br> <button type="submit" name="submit" value="submit"> Send Mail </button> </form> </body> </html>';}
http://php.flashwebhost.com/sherly/mailform.php
Code:<?php if (isset($_POST['submit'])) { $formEmail = $_POST['formEmail']; $body = $_POST['body']; mail('[email protected]', 'Message from Web Site', $body , 'From: ' . $fromEmail . "\n\r"); echo 'Thanks for Contacting us'; } else { echo '<!doctype html> <html lang="en"> <head> <meta charset = "UTF-8"> <title> Contact Us </title> </head> <body> <form action= "mailform.php" method="POST"> Email <br> <input type="text" name="fromEmail"> <br> Message <br> <textarea name="body" cols="30" rows="10"></textarea> <br> <button type="submit" name="submit" value="submit"> Send Mail </button> </form> </body> </html>';}
Last edited by sherlyk; 06-04-2014 at 05:47 AM.
When mail is submitted, it will be sent to [email protected]
That can result in spam complaint as you don't own that email address. So make sure you set it to your email address, so only you get the email.PHP Code:mail('[email protected]', 'Message from Skype', $body , 'From: ' . $fromEmail . "\n\r");
You can delete the script later, if not spam bots will find it and sent spam message using the contact us form, this is why many sites use Captcha on contact forms.
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/mini/email.php
Code:<?php if (isset($_POST['submit'])) { $fromEmail = $POST['fromEmail']; $body = $_POST['body']; mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail . "\n\r"); echo 'Thank you for contacting us.'; } else { echo '<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Contact Us</title> http://php.flashwebhost.com/mini/email.php <form action="email.php" method="POST"> Email<br> <input type="text" name="fromEmail"><br> Message<br> <textarea name="body" cols="40" rows="10"></textarea> <br> <button type="submit" name="submit" value="submit">Send Mail</button></form> </body> </html> ';}
http://php.flashwebhost.com/ramesh/day-12/contact1.php
PHP Code:<?php
if (isset($_POST['submit'])) {
$fromEmail = $_POST['Email'];
$body = $_POST['body'];
mail('[email protected]','Message from web site', $body, 'From: ' . $Email);
echo 'Thank you for contacting us.';}
else {
echo
'<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact Us</title>
</head>
<body>
<form action="contact1.php" method="POST">
Email<br> <input type="text" name="Email"><br>
Message<br> <textarea name="body" cols="30" rows="10"></textarea>
<br> <button type="submit" name="submit" value="submit">Send Mail</button></form>
</body></html>
';}
Last edited by rameshxavier; 06-18-2014 at 11:44 AM.
Bookmarks