Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

PHP mail submissions not working


ghost's Avatar
0 0

Hey, i created this simple email form that uses php to send me the email, however, I don't receive the emails. I typed and re-typed everything over again to make sure I got it, but nothing! Would you please take a look and see if there's anything wrong with my code?

sendmail.php:

<?php

$email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ;

mail( "myemailaddress@something.com", "Subject", $message, "From: $email" ); header( "Location: nextpage.html" ); ?>

The Form (contact.html):

<form action="sendmail.php" method="post"> Email <input type="text" name="email" value="" /><br /> Message <textarea name="message" value="" /><br /> <input type="submit" value="Send" /> </form>


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

Where are you trying to do this from, not all servers have an smtp server ;)


ghost's Avatar
0 0

110mb.com


ghost's Avatar
0 0

At some webbservers I've heard they request a sender mail-adress witch u send in a header like this:

$headers = &quot;From: &#39;.$email.&#39; &lt;&#39;.$email.&#39;&gt;&#92;r&#92;n&quot;;

Then send the mail like this:

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

Dont know if it makes any difference but it might bee worth a try.


ghost's Avatar
0 0
&lt;?php
$to=&quot;domain@email.com&quot;; //recievers email
$subject=&quot;this is an email&quot;; //email subject
$body=&quot;blah blah blah&quot;; //main body of the message
$header=&quot;From: sender@email.com&#92;n&quot;; //the email you wish to send from
mail($to,$subject,$body,$header);
echo &quot;Your email was sent to $to $header&quot;;
?&gt;