plutomed Posted March 13, 2009 Share Posted March 13, 2009 This bit of code all works fine up to sending the email. I don't receive it. <h2>Send us an E-Mail</h2> <? if($_POST['name']) { echo "Your message has ben sent, a copy has been forwarded to your E-Mail."; $Name = $_POST['name']; $Email = $_POST['email']; $Subject = $_POST['subject']; $Message = wordwrap($_POST['message'], 70); mail(str_replace("££", "@","me££plutomedia.net"), "Harrison Technology site - ".$Subject, $Message, "From:".$Name."<".$Email.">"."\r\n"."Reply-To:".$Email); } ?> <form action="/contact" method="post"> <table> <tr> <td><label>Name: </label></td> <td><input type="text" name="name" /></td> </tr> <tr> <td><label>Subject: </label></td> <td><input type="text" name="subject" /></td> </tr> <tr> <td><label>Email: </label></td> <td><input type="text" name="email" /></td> </tr> <tr> <td><label>Message: </label></td> <td><textarea name="message" cols="100" rows="20"></textarea></td> </tr> <tr> <td></td> <td><input type="submit" value="Send" /> <input type="reset" value="Clear" /></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/ Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 Is there a way to check if an E-Mail has been sent via php? Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784235 Share on other sites More sharing options...
samshel Posted March 14, 2009 Share Posted March 14, 2009 u can check if it is sent..the mail() function returns it, but it does not tell u whether it reached the destination properly or not. u have to configure something like smtp to actually send mail. PHP mail() function uses it, it itself is not a mail engine. Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784237 Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 I'm using a hosting company and they have all that set up. It has worked before in the past. Can you see a problem in the code atall? Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784244 Share on other sites More sharing options...
samshel Posted March 14, 2009 Share Posted March 14, 2009 try sending a simple mail..if it works , problem is with code, else it is with mail setup mail("[email protected]", "test", "test", 'From: TEST <[email protected]>'); and yes check ur spam mail folder too Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784248 Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 Hmm...Must be the mail setup. Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784257 Share on other sites More sharing options...
PFMaBiSmAd Posted March 14, 2009 Share Posted March 14, 2009 Add the following two lines immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Most likely cause for your mail server to not send the email or for the receiving mail server to reject it - The From: address must be a mail box hosted at the sending mail server. Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784259 Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 <? ini_set ("display_errors", "1"); error_reporting(E_ALL); mail("<email>", "test", "test"); ?> That is my code. I get no error and no email. Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784264 Share on other sites More sharing options...
Floydian Posted March 14, 2009 Share Posted March 14, 2009 do you have access to the mail queue? if you don't, or don't know what that is, your web host does. you can check the mail queue to see if the mail is placed in there, which is where it goes immediately after php executes the mail function I see you're using the short tag <? Have you tried using the regular <?php ? Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784268 Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 I would have to email them then and they take a while to respond. I use the short tags for everything and that works but I'll give it a go. Long tags didn't make a difference. Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784269 Share on other sites More sharing options...
alphanumetrix Posted March 14, 2009 Share Posted March 14, 2009 You may not have the PHP mail() function enabled on your server. A lot of people have this problem. As an alternative, you can use PHP Pearl's Mail via SMTP. If you have SMTP, e-mail me for more info: [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784303 Share on other sites More sharing options...
plutomed Posted March 14, 2009 Author Share Posted March 14, 2009 How do you know if it's enabled? Quote Link to comment https://forums.phpfreaks.com/topic/149331-mail/#findComment-784873 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.