email.php wont work in 5.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinwisker
Forum Newbie
Posts: 5
Joined: Sun Oct 17, 2010 7:01 pm

email.php wont work in 5.

Post 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);

?>
Last edited by Benjamin on Sun Oct 17, 2010 7:46 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: email.php wont work in 5.

Post by Benjamin »

:arrow: Moved to PHP - Code
tinwisker
Forum Newbie
Posts: 5
Joined: Sun Oct 17, 2010 7:01 pm

Re: email.php wont work in 5.

Post by tinwisker »

Benjamin wrote::arrow: Moved to PHP - Code
New user...dont understand???
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: email.php wont work in 5.

Post 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.
tinwisker
Forum Newbie
Posts: 5
Joined: Sun Oct 17, 2010 7:01 pm

Re: email.php wont work in 5.

Post by tinwisker »

A new server that I've never used before.
Linux.
No.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: email.php wont work in 5.

Post by requinix »

Is sendmail (or another MTA) installed and running?
Post Reply