Hi guys, first post here.

I've searched this forum for previous answers to this, but came up short. Hopefully someone here can be kind enough to help.

Ok, so I've managed to get a sendmail script runnning and working well.

It's very basic, goes like this

[INDENT]<?php
$email_to = "example@mysite.com";
$name = $POST["name"];
$email_from = $
POST["email"];
$message = $_POST["message"];
$email_subject = "Feedback from website";
$headers =
"From: $email_from .\n";
"Reply-To: $email_from .\n";

$message = "Name: ". $name . "\r\nMessage: " . $message;

ini_set("sendmail_from", $email_from);
$sent = mail($email_to, $email_subject, $message, $headers, "-fexample@mysite.com" .$email_from);
if ($sent)
{
header("Location: http://www.mysite-example.com/thankyou.html");
} else {
echo "There has been an error sending your comments. Please try later.";
}
?>[/INDENT]

Works perfectly & was surprisingly easy to implement.

So my questions are:

Is this script secure from potential spammers? I've been reading up about them hi-jacking the script to send multiple emails etc.

If it's not secure, can someone suggest a way of making it so? By the way, it's hosted on Fasthosts which specifies that i must use an Inbow & Outbox that is also hosted within the site. Not sure if that helps or not.

Thanks in advance.

Shane

    its secure from sending spam to anyone other than you.

      That's fantastic. Thanks for the fast reply.

      So there're no flaws in the code? It's only used as a feedback form.

        ozzysworld;10928554 wrote:

        So there're no flaws in the code? It's only used as a feedback form.

        you can go crazy and filter bcc\cc et al from the input; but as you headers are all fixed it could only be in the message body which would not do nothing. There's lots of web sites on this if you want to read up on it.

          Ah, so this code 'fixes' the headers to stop them adding cc & bcc?

          Awesome. Seems like a simple solution to the spam issue.

          Thanks alot

            Write a Reply...