Jump to content

Recommended Posts

Posted

This is my php code:

<?php
 $email = $_REQUEST['email'] ;
 $message = $_REQUEST['message'] ;

 mail( "myname@example.com", "Feedback Form Results",
   $message, "From: $email" );
 header( "Location: http://www.example.com/thankyou.html" );
?>

My html:

form method="post" action="sendmail.php">
<p><label for="name">Name</label> <input type="text" id="name" /></p>
<p><label for="email">Email</label> <input type="text" id="e-mail" /></p>
<p><label for="message">Message</label> <textarea id="message" cols="30" rows="10"></textarea></p>
<p><input type="submit" value="submit" style="margin-left: 150px" /> </p></form>

 

When I click submit, it goes to the /thankyou.html, but I do not receive the mail in my myname@example.com inbox? Does it take a while to send or is my code wrong? Thanks!

Posted

You didn't give your text fields a name.

 

<input type="text" id="name" />
<input type="text" id="email" />

 

Should be:

 

<input type="text" name="name" id="name" />
<input type="text" name="email" id="email" />

 

You could put both the php and html on one page if you wanted by using an if statement. Saves you from having to make two pages.

 

<?php
if ( $_REQUEST[email] && $_REQUEST[message] )
{
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
mail( "me@heliohost.org", "Feedback Form Results", $message, "From: $email" );
header( "Location: http://www.example.com/thankyou.html" );
exit;
}
?>

<html>
<head>
<title></title>
</head>
<body>

<!-- DO NOT SPECIFY FORM ACTION -->
<form method="post" action="">
<p><label for="name">Name</label> <input type="text" name="name" /></p>
<p><label for="email">Email</label> <input type="text" name="email" /></p>
<p><label for="message">Message</label> <textarea name="message" cols="30" rows="10"></textarea></p>
<p><input type="submit" value="submit" style="margin-left: 150px" /> </p></form>
</body>
</html>

 

 

Posted

See if you like this "Contact Me" emailer. Go ahead and try it, everything works except I disabled the mail function for the demo page.

http://byrondallas.heliohost.org/temp/email_form.php

 

Upload to your site if you want:

http://byrondallas.heliohost.org/temp/email_form.txt

 

I think I posted the same script for you the other day but I didn't realize I had my table data alignment off. This should be fixed now.

 

Posted
See if you like this "Contact Me" emailer. Go ahead and try it, everything works except I disabled the mail function for the demo page.

http://byrondallas.heliohost.org/temp/email_form.php

 

Upload to your site if you want:

http://byrondallas.heliohost.org/temp/email_form.txt

 

I think I posted the same script for you the other day but I didn't realize I had my table data alignment off. This should be fixed now.

Thanks a bunch. Will try it out

 

Hmm...

I added everything, but when I click "send" it doesn't appear in my inbox. Here is my contact form

Posted
Hmm...

I added everything, but when I click "send" it doesn't appear in my inbox. Here is my contact form

 

You need to rename your page with a .php extension instead of an html extension.

 

Contact.php

 

 

 

Posted
Hmm...

I added everything, but when I click "send" it doesn't appear in my inbox. Here is my contact form

 

You need to rename your page with a .php extension instead of an html extension.

 

Contact.php

Now I get a: "500 Internal Server Error"

Posted
Now I get a: "500 Internal Server Error"

 

Your contact form is working for me and I even sent you a message.

Really? I never got it.

I double checked and the email in the code is correct.

Posted

I sent you a message... I can see your contact form

 

I was wondering, why don't you use a CMS like Joomla Or PHPNuke, It would make your site look better...

Posted

Yeah, it looks fine now - but it won't actually send to my email address

EDIT:

 

I got this error log yesterday:

[05-Sep-2009 08:26:53] PHP Warning:  mail() [<a href='function.mail'>function.mail</a>]: Could not execute mail
delivery program '/usr/sbin/sendmail -t -i' in /home/replay/public_html/Contact.php on line 6

[05-Sep-2009 08:26:53] PHP Warning:  Cannot modify header information - headers already sent by (output started at 
/home/replay/public_html/Contact.php:6) in /home/replay/public_html/Contact.php on line 7

Posted
Yeah, it looks fine now - but it won't actually send to my email address

 

Did you check your spam folder? I copied your source code yesterday while it was an html page and tried it on my site and used my email address instead so I know it works ok.

 

 

 

 

Replace the php part on your email form with this and see if that helps. Don't forget to change the email address to yours.

 

<?php
if ( $_REQUEST[email] && $_REQUEST[message] )
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$headers  = "From: $name <$email>\n";  
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
mail( "your_email@yahoo.com", "Replay Band Inquiry", $message, $headers );
header( "Location: http://replayband.heliohost.org/Contact.php" );
exit;
}
?>

 

 

Posted
Yeah, it looks fine now - but it won't actually send to my email address

 

Did you check your spam folder? I copied your source code yesterday while it was an html page and tried it on my site and used my email address instead so I know it works ok.

 

 

 

 

Replace the php part on your email form with this and see if that helps. Don't forget to change the email address to yours.

 

<?php
if ( $_REQUEST[email] && $_REQUEST[message] )
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$message = $_REQUEST['message'];
$headers  = "From: $name <$email>\n";  
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
mail( "your_email@yahoo.com", "Replay Band Inquiry", $message, $headers );
header( "Location: http://replayband.heliohost.org/Contact.php" );
exit;
}
?>

 

Hmm.. Works with my yahoo! account, but not my shaw.

Now I just need it to work with my_email@shaw.ca

Posted
Hmm.. Works with my yahoo! account, but not my shaw.

Now I just need it to work with my_email@shaw.ca

 

You need to conact shaw.ca and ask them if they are blocking heliohost and ask them how to correct it.

 

 

 

 

 

Posted
Hmm.. Works with my yahoo! account, but not my shaw.

Now I just need it to work with my_email@shaw.ca

 

You need to conact shaw.ca and ask them if they are blocking heliohost and ask them how to correct it.

 

Ok - Thanks for all the help!

Everything should be working fine now.

  • 1 month later...
Posted

Hey, guys ,is there any scope of receiving mail via PHP scripts.If not,in future releases?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...