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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>';

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.