Jump to content

Simple Email script problems


Angeleyezz

Recommended Posts

Ok, I submit the form, and when the next page displays, it says recieved with the persons name, but it wont post their email, and it wont ever send the message to the email address......... i've been playing with it all day long and just cannot figure it out, about to rip my hair out... any help would be appreciated.

 

 

Contact.php page

<?php 
// Header Include
include('includes/header.php');
?>

<!-- BEGIN SITE CONTENT INCLUDES HERE -->

<!-- Index page included -->

<table border="0" cellpadding="5" cellspacing="0" width="300" align="center">
  <tr>
    <td><font face="verdana" size="2" color=#"000000"><b>Feedback Form</b></font></td>
  <tr>
    <td><form name="contact"  method="post" action="contact_submit.php">
        <font face="verdana" size="1" color="#1b4a1b">Your Name:<br />
        <input type="text" name="name" size="25" />
        <br />
        Email:<br />
        <input type="text" name"email" size="25" />
        <br />
        Comments:</font><br />
        <textarea name="comments" rows="5" cols="30"></textarea>
        <br /><input type="submit" name="submit" value="Send" />
        </form></td>
  </tr>
</table>
<br /><br />

<!-- / End Index Page -->

<!-- / END SITE CONTENT INCLUDES HERE -->


<!-- Footer Include -->
<?php
include('includes/footer.php');
?>

 

 

Form Processing Script

contact_submit.php

<?php 
$to = "tonyagmatrix@gmail.com";
$re = "Feedback Form";
$msg = $comments;
mail($to,$re,$msg);
?>
<html><head><title>Message Recieved</title></head>
<body>
<h3>Thank you for your feedback <?PHP echo ($name); ?></h3>
<br />We value your opinions and any questions will be replyed to your email address: <?php echo ($email); ?>
</body></html>

 

Does anyone have any idea wtf is wrong?

Link to comment
Share on other sites

As for not seeing posted info:

 

unless you have register globals turned on (which you shouldn't, and isn't something on be default unless you are using an old version of php), you can access posted variables using the $_POST array.  Example: $_POST['email']

 

As for not getting mail:

 

First off, did you check your spam/trash/junk folder? Where are you running this script from?  using the mail() requires a mail server to be setup.  If you are doing t his on your own computer with something like WAMP or XAAMP then you more than likely do not have a mail server setup.  Or, if you are running this off some really cheap or free hosting service, more than likely they do not allow you to use things like mail().

 

Link to comment
Share on other sites

i have a hosted reseller account with vortechhosting.com,

 

i posted my php info for you http://www.reelkingz.com/phpinfo.php

 

Definitally not in the junk folder, I was hoping it would have ended up there, but it didnt.

 

The weird thing is it will take the $name from the post, but it wont take the $email from there and print it on the result page, thats the part thats got me really confused. aside from the message not sending at all.

 

I don't have access to change the php.ini file at all, so im kinda stuck outta luck with that if theres something out of place on the info,  do you see anything out of place on why the script isnt working from the info?

Link to comment
Share on other sites

well as for $email not showing up, i see in your form

 

<input type="text" name"email" size="25" />

 

you are missing the = for name="email"

 

but..if you see $name just fine and then adding that = will fix seeing $email...that means that you DO have register globals turned on??

 

edit: holy crap, you DO have register globals turned on! (I see it in your phpinfo() you posted).  IMO you should probably find a new host ASAP.  A hosting company who allows this sort of thing...

Link to comment
Share on other sites

Well no, your script is not NOT mailing because of register globals being on (it should be off, not on).  that's unrelated.

 

I don't really see an immediate reason why it shouldn't be working.  Try sending some proper email headers (see example #2 of the mail manual entry).  Try sending to a couple different email addresses.  Perhaps gmail doesn't like your host and is automatically filtering emails from it.

Link to comment
Share on other sites

you mean replace my code with this? then what just access the page and itll automatically send it?  im kinda new at this also lol

 

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 

Link to comment
Share on other sites

okay well at this point in time, my suggestion would be to talk to your host and ask them to make sure stuff is setup right on their end, like ask them to make sure their email server is setup correctly.  Show them your script as a reference.  I can't think of any other reason why the script would fail, unless every email address you tried to send it to just so happens to block email from your host... which I suppose is possible if they have a history of spammers sending email from them.  But yeah..I think at this point in time it would be appropriate to hit your host up and ask them wtf.

Link to comment
Share on other sites

the host is terrible anyway, their too expensive, and it seems like they went down hill over the years.  im going to migrate to someone new, any suggestions for a good reseller?  i was looking into hostclear.com  i donot know.....

 

I even tried to make an email address from my own domain and sent the "to" to that mail, and still, nothing..... sad

Link to comment
Share on other sites

I don't really know offhand any good reseller hosts / reseller hosting plans.  Maybe a good place to start before making your own thread is the Web Host List sticky that lists suggested/recommended hosts.  Perhaps people specifically listed reseller features as reasons. Or if nobody specifically mentions your needs in that thread, you can always start your own thread asking about it in the Misc. Forum

Link to comment
Share on other sites

Which host are you using?

 

phps inbuilt mail function is great, however some hosting companies are cracking down on how it is used.

 

for example, godaddy is very unreliable when it comes to using mail(). mail usually doesnt get sent, or is very very delayed. This is due to godaddy being accussed of spam etc due to spamming customers.

 

To make mail work on hosts such as godaddy, you need to look into using something like pear & php's mail together.

 

look here: http://pear.php.net/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.