Jump to content

Email Form Not Sending


Guest Rebel

Recommended Posts

Guest Rebel

I have tried allot of php mail forms on my website but nothing works, im not receiving any emails what ever i do.

On a other forum they say that my mail-function() is not working and i need to contact heliohost.

So does anybody know what the problem is.

Link to comment
Share on other sites

I just checked and both servers are sending mail with the php mail() function.

 

This should work for you as a test:

 

<?php
$to       = "YOUR_EMAIL@gmail.com";
$subject  = "Test Email";
$message  = "Sending A Test Email.";
$headers  = "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
$headers .= "From: YOU@heliohost.org" . "\r\n" . "BCC: $maillist\n";
if (mail($to, $subject, $message, $headers)) {
echo "<br><p><b>Message successfully sent!</b></p><hr><br>";
echo "From: YOU<br>";
echo "To: Me<br>";
echo "Bcc: $bcc<br>";
echo "Subject: $subject<br>";
echo "Message: $message<br>";
exit;
} else {
echo "<p>Message delivery failed...</p>";
}
?>

 

Link to comment
Share on other sites

Guest Rebel

Yes this works, i already tried something the same that worked also.

But not when i use scripts from internet with forms to fill in, i tried like 12 different ones.

 

Like this one, this one used to work on other servers years ago:

<?
error_reporting(E_ALL);
if (isset($_POST['submit']))
{  
 if (empty($_POST['naam']) OR empty($_POST['replyemail']) OR empty($_POST['inhoud']))
 {
   print("Vul het veld helemaal in. <br />[<a href=\"JavaScript:history.back(-1)\">terug</a>]");
 }
 elseif(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$",$_POST['replyemail']))
 {
   print("Vul een geldig emailadres in");
 }
 else
 {
   $headers .= "From: <Mijn naam - Website >\n";  
   $headers .= "X-Sender: <$replyemail>\n";  
   $headers .= "X-Mailer: PHP\n";  
   $headers .= "X-Priority: 1\n"; 
   $headers .= "Return-Path: <$replyemail>\n";  
   $ip = $_SERVER['REMOTE_ADDR']; 
   $inhoud = " 
   De Gegevens:

   Naam:	   ".$_POST['naam']."
   Emailadres: ".$_POST['replyemail']."
   IP adres:   $ip

   Het Bericht: 

   $bericht";

   mail ("mijnemail@live.nl","Het Gastenboek.",$inhoud,$headers);

   echo "<script language=\"javascript\">
   window.alert ('Verzonden');
   </script>";


   //automatisch een mailtje terugzenden...

   $headers2 .= "From: <mijn naam - Website>\n";
   $headers2 .= "X-Sender: <mijn email>\n";
   $headers2 .= "X-Mailer: PHP\n";
   $headers2 .= "X-Priority: 1\n";
   $headers2 .= "Return-Path: <mijn email>\n";
   $onderwerp2 .= "Bevestigings Email.";
   $bericht2 .= "Beste $naam,

   Je bericht is ontvangen! Het wordt eerst gelezen door mij.
   Als het een GOED bericht is, zal het worden geplaatst in Het Gastenboek.


   Met vriendelijke groeten,

   Mijn naam
   http://www.site.tk";

   mail ($_POST['replyemail'],$onderwerp2,$bericht2,$headers2);
 }
}
?>

Link to comment
Share on other sites

Guest Rebel

OK this email form does work.

but the whole validation does not work, not even on your own site.

when you write only your name press send it doesnt say anything it just clears the whole form.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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...