Jump to content

Contact forms not always arriving


barça

Recommended Posts

Hi
Ive just made my first webpage for a friend's restaurant and I have got a contact form which sends emails to two addresses (depending which subject is chosen).
Everything seems OK and Im new to php so the code itself is still a little baffling, its made of a mixture of script i found on the web and some help from forums.

One problem, when I test the contact sheet, only about fifty percent of the time do they actually arrive to my inbox. Why could this be? Is it a problem in the html page with the form:
[a href=\"http://www.bernisnudelbrett.de/en/contact_us.html\" target=\"_blank\"]http://www.bernisnudelbrett.de/en/contact_us.html[/a]

or in the coding on the php page?
The code is as follows:

[code]<?php
$emailfield = $_POST['emailfield'];
$concern = $_POST['concerning'];
if ($concern == 'information') {
    $mailto = 'info@bernisnudelbrett.de';
}
else {
    $mailto = 'web@bernisnudelbrett.de';
}
$mailsubj = "A message from a website visitor";
$mailhead = "From: ".$emailfield;
$mailbody = "A message from a website visitor:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
?>
[/code]

Any help would be much appreciated, Ive just got PHP for dummies, but as someone who hasnt used computer language like this before, it's still a bit baffling to me.

Thanks
Barça
Link to comment
Share on other sites

When sending emails with PHP sometimes email clients treat these as spam emails and so they dont arrive in your inbox instead they'll be located in your junk/spam folder.

Also I see you are not validating user input, you should validate user input as a malicous hacker/spammer could pertentially spam your client.
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Also I see you are not validating user input, you should validate user input as a malicous hacker/spammer could pertentially spam your client.[/quote]


Is that just a question of adding a line? Could you point me in the right direction for that?

At the moment, the emails are redirected from the emails of the same domain to other emails (controlled from a panel provided by the hosting service) I know I can set it up so there's a catchall account, but is that necessary? My email client that recieves them at the end shows everything in my inbox so I know the problem is not there as it has no spam filters.
Link to comment
Share on other sites

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.