Jump to content

Need some help with my mail form please.


Pastulio

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/55483-need-some-help-with-my-mail-form-please/
Share on other sites

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 =/

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.

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

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

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.

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 protected]'."\r\n";
$headers .= 'From: Your Name <[email protected]>';

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, "-f[email protected]"); // Notice there is no space in the whole envelope thingy

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

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