day_12_ex_1.php and day_12_ex_2.php delete it after you test. If not if someone visit those pages.. you will get email, that can get annoying if you forget where you put the script.
day_12_ex_1.php and day_12_ex_2.php delete it after you test. If not if someone visit those pages.. you will get email, that can get annoying if you forget where you put the script.
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/annie/mail.php
Code:<?php $toEmail = '[email protected]'; $fromEmail = '[email protected]>'; $subject = 'TIME FOR GOD '; $body = ' Hi , If You Love God... And, are not ashamed of all the marvelous things HE has done for you... GOD BLESS! swapz '; mail ($toEmail, $subject, $body); echo ' Mail send to ' . $toEmail;
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
Following error showing day_12_ex_3.php
Parse error: syntax error, unexpected '$body' (T_VARIABLE) in day_12_ex_3.php on line 5
Missing ( ; ) in
$fromEmail = $POST['fromEmail']
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
Sender email address not getting in inbox.
its showing as 'unknown sender'
in day_12_ex_3.php, i changed the below line
$fromEmail = $POST['fromEmail'];
to
$fromEmail = $_POST['fromEmail'];
and now its working.
http://php.flashwebhost.com/sibichan...ay_12_ex_3.php
PHP Code:
<?php
if (isset($_POST['submit'])) {
$fromEmail = $_POST['fromEmail'];
$body = $_POST['body'];
mail('[email protected]','Message from web site', $body, 'From: ' . $fromEmail);
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="day_12_ex_3.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 Vahaa11; 06-03-2014 at 05:53 AM.
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.
Bookmarks