Jump to content

Archived

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

barça

Contact forms not always arriving

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.