Page 1 of 1

email.php wont work in 5.

Posted: Sun Oct 17, 2010 7:08 pm
by tinwisker
I have been using the following email.php in combination with a .swf file and now it wont work on a server using php 5.
Any insight would be greatly appreciated!

Mark

Code: Select all

<?php
/***************************************************\
* PHP 4.1.0+ version of email script. For more
* information on the mail() function for PHP, see
* http://www.php.net/manual/en/function.mail.php
\***************************************************/


// First, set up some variables to serve you in
// getting an email.  This includes the email this is
// sent to (yours) and what the subject of this email
// should be.  It's a good idea to choose your own
// subject instead of allowing the user to.  This will
// help prevent spam filters from snatching this email
// out from under your nose when something unusual is put.

$sendTo = "m.fogarty@2b5.biz";
$subject = "LSR Mailing List";

// variables are sent to this PHP page through
// the POST method.  $_POST is a global associative array
// of variables passed through this method.  From that, we
// can get the values sent to this page from Flash and
// assign them to appropriate variables which can be used
// in the PHP mail() function.


// header information not including sendTo and Subject
// these all go in one variable.  First, include From:
$headers = "From: " . $_POST["fName"] ." ". $_POST["lName"] . "<" . $_POST["eMail"] .">\r\n";
// next include a replyto
$headers .= "Reply-To: " . $_POST["eMail"] . "\r\n";
// often email servers won't allow emails to be sent to
// domains other than their own.  The return path here will
// often lift that restriction so, for instance, you could send
// email to a hotmail account. (hosting provider settings may vary)
// technically bounced email is supposed to go to the return-path email
$headers .= "Return-path: " . $_POST["eMail"];

// now we can add the content of the message to a body variable
$message =  "First Name:  " . $_POST["fName"] ."\r\nLast Name:  ". $_POST["lName"] ."\r\nPhone:  ". $_POST["phone"] ."\r\nE-mail:  ". $_POST["eMail"] ."\r\nAddress:  ". $_POST["address"] ;
// next include a replyto
// once the variables have been defined, they can be included
// in the mail function call which will send you an email
mail($sendTo, $subject, $message, $headers);

?>

Re: email.php wont work in 5.

Posted: Sun Oct 17, 2010 7:47 pm
by Benjamin
:arrow: Moved to PHP - Code

Re: email.php wont work in 5.

Posted: Sun Oct 17, 2010 7:54 pm
by tinwisker
Benjamin wrote::arrow: Moved to PHP - Code
New user...dont understand???

Re: email.php wont work in 5.

Posted: Sun Oct 17, 2010 8:20 pm
by requinix
tinwisker wrote:and now it wont work on a server using php 5.
With a server? Or the same server as before? Linux or Windows? Did you need any custom SMTP settings?
tinwisker wrote:New user...dont understand???
You posted your question in one of the other forums, but since it was more appropriate to ask it here Ben moved it.

Re: email.php wont work in 5.

Posted: Sun Oct 17, 2010 8:39 pm
by tinwisker
A new server that I've never used before.
Linux.
No.

Re: email.php wont work in 5.

Posted: Sun Oct 17, 2010 10:09 pm
by requinix
Is sendmail (or another MTA) installed and running?