Pastulio Posted June 13, 2007 Share Posted June 13, 2007 // Send Email $subject = "Service Request van: $postFullName ($postMail)"; $to = "********@hotmail.com"; $message = "De volgende informatie is ingegeven: \n\n". "PERSOONLIJKE INFORMATIE:\n\n". "Volledige naam: $postFullName \n". "Adres: $postAdress \n". "Huisnummer: $postNr \n". "Land: $_POST[country] \n\n". "CONTACT INFORMATIE:\n\n". "Telefoon nummer: $postTelNr \n". "Mobiel nummer: $postMobNr \n". "E-mail: $postMail \n\n". "PRODUCT INFORMATIE:\n\n". "Product: $_POST[product] \n". "Merk: $postBrand \n". "Tiepe: $postType \n". "Aankoop bij: $postBoughtAt \n". "Aankoop datum: $_POST[day] $_POST[month] $_POST[year]\n\n". "Storing: $postProblem\n\n". "Wenst bereikt te worden via: $r1 $r2 $r3."; $headers = "From: $postMail" . "\r\n" . "Reply-To: $postMail" . "\r\n" . "X-Mailer: PHP/" . phpversion(); mail ($to, $subject, $message, $headers); This is the code from where my E-mail should be sent. But the mail will not send, Any Idea on as to why this is? any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted June 13, 2007 Share Posted June 13, 2007 Does it throw an error? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 13, 2007 Author Share Posted June 13, 2007 Nope that's the problem. I'm sure the would be no Syntax error, but it does not display ANY error. but the mail is still not sent. I tried to make an "if" case for it and it always replied the mail could not be sent. Maybe the problem is host related I don't know. Thanks though =/ Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 14, 2007 Author Share Posted June 14, 2007 *bump* Quote Link to comment Share on other sites More sharing options...
AndyB Posted June 14, 2007 Share Posted June 14, 2007 How did you determine that the email was not sent? More likely is that you didn't receive it (or it ended up in your spam folder). What happens when you use a true domain email address rather then a free webmail service? Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 14, 2007 Author Share Posted June 14, 2007 I have used my hotmail account for the simple reason of verifying if the E-mail is getting sent. It does not appear in my inbox, nor my spam folder. I tried G-mail aswel, but the form is a Service Request for a company I'm doing, and it's pretty annoying that it doesn't work. Quote Link to comment Share on other sites More sharing options...
mr_zhang Posted June 14, 2007 Share Posted June 14, 2007 Perhaps the problem is in the header. As far as I know the header should be formatted like 'From: $name <$email>'. (I'm assuming your $postMail only contains email address) Try to erase all the header. It's optional anyway. If it works then you'll know that it's the header. Then you can fix the header one by one. Oh ya, some hosting server requires one of the sender / receiver email address is on their server. You could check this too with your hosting. Regards Quote Link to comment Share on other sites More sharing options...
nodster Posted June 14, 2007 Share Posted June 14, 2007 Easiest way to check is to remove the $to in your variables and just type in the email address you wish it to be sent to in the first part of the mail() function. Not the most graceful way but you'll at least know if it works. :-\ sure somebody will have a simpler answer Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 14, 2007 Author Share Posted June 14, 2007 Thanks a lot guys gonna check it out. I mean I've done hundreds of mail forms before and never had any problem =/. but gonna try the headers first and fill in the E-mail, and then contact the host . And if all else fails I'm just gonna make a MySQL database and create an inbox. Quote Link to comment Share on other sites More sharing options...
Nhoj Posted June 14, 2007 Share Posted June 14, 2007 I've been using the following mail headers for quite a long time and so far my mail always seems to get through: $headers = 'MIME-Version: 1.0'."\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n"; $headers .= 'Return-Path: email@yourdomain.com'."\r\n"; $headers .= 'From: Your Name <email@yourdomain.com>'; Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 14, 2007 Author Share Posted June 14, 2007 Still nothing think I'm gonna try to make one from scratch and if that doesn't work. The MySQL thing. Thanks a lot guys, hope you won't be hearing from me anymore Quote Link to comment Share on other sites More sharing options...
Nhoj Posted June 14, 2007 Share Posted June 14, 2007 You may want to make sure reverse DNS is enabled on your server. A lot of popular places such as @aol.com and @hotmail.com require reverse dns. EDIT: forgot to mention, sometimes having the envelope from tag on your mail() function helps. Something like: mail ($to, $subject, $message, $headers, "-femail@yourdomain.com"); // Notice there is no space in the whole envelope thingy Quote Link to comment Share on other sites More sharing options...
Pastulio Posted June 14, 2007 Author Share Posted June 14, 2007 Thanks A lot man I'll try it but I've started from scratch so I'm gonna do that first. Quote Link to comment Share on other sites More sharing options...
AndyB Posted July 3, 2007 Share Posted July 3, 2007 What Nhoj has posted is sometimes referred to as the 'fifth parameter' - documented in the php manual for the mail() function. Quote Link to comment 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.