PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
IBM developerWorks
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old February 13th, 2004, 09:16 PM
bass 305 bass 305 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 bass 305 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
email form won't work

Hi everybody, new to this, so i need your help, i downloaded a form in flash from this site that form should send email by this code

[highlight=php]
<?

$to = "perraquillo@msn.com";
$msg = "Name of sender: $title $namenn";
$msg .= "Favourite SSl: $sslnn";
$msg .= "Favourite Coffee shop: $coffeenn";
$msg .= "$messagenn";

mail($to, $subject, $msg, "From: My web sitenReply-To: $emailn");

?>
[php]

the data is provided by the swf but i uploaded both files and nothing happens,well only i get the thank you screen, please help

Reply With Quote
  #2  
Old February 13th, 2004, 09:27 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: email form won't work

is that all of the code? Wherever you downloaded that from, its awfully stripped down, and doesnt even contain some of the variables referenced.

Reply With Quote
  #3  
Old February 13th, 2004, 09:30 PM
bass 305 bass 305 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 bass 305 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: RE: email form won't work


well the data that fills the variables in this code should be provided by a flash swf

Reply With Quote
  #4  
Old February 13th, 2004, 09:36 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: email form won't work

for it to properly work, im not sure how flash would pass them, but they still have to be definied in the php script....Where did you get this information from just out of curiousity??

Reply With Quote
  #5  
Old February 13th, 2004, 09:39 PM
bass 305 bass 305 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 bass 305 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
email form won't work

well, if you search "form" in this site's engine you'll find in tutorial one that says "Creating a Mail Form with PHP and Flash by George (viewed 41770 times)"
that's the one

Reply With Quote
  #6  
Old February 13th, 2004, 10:01 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: email form won't work

The tutorial gives this code:

php Code:
Original - php Code
  1.  
  2. <?php
  3. $to = "you@yourdomain.com";
  4. $msg = "$namenn";
  5. $msg .= "$messagenn";
  6. mail($to, $subject, $msg, "From: My web sitenReply-To: $emailn");
  7. ?> 


This is your code:

php Code:
Original - php Code
  1.  
  2. <?
  3.  
  4. $to = "perraquillo@msn.com";
  5. $msg = "Name of sender: $title $namenn";
  6. $msg .= "Favourite SSl: $sslnn";
  7. $msg .= "Favourite Coffee shop: $coffeenn";
  8. $msg .= "$messagenn";
  9.  
  10. mail($to, $subject, $msg, "From: My web sitenReply-To: $emailn");
  11.  
  12. ?>


Are the variables $title, $name, $ssl, $coffee and $message, and $email all set up as fields in your flash movie? If they are, we can build the script like this:

php Code:
Original - php Code
  1.  
  2. <?php
  3. $name=$_POST['name'];
  4. $title=$_POST['title'];
  5. $ssl=$_POST['ssl'];
  6. $coffee=$_POST['coffee'];
  7. $message=$_POST['message'];
  8. $subject=$_POST['subject'];
  9. $email=$_POST['email'];
  10.  
  11. $to = "perraquillo@msn.com";
  12. $msg = "Name of sender: $title $namenn";
  13. $msg .= "Favourite SSl: $sslnn";
  14. $msg .= "Favourite Coffee shop: $coffeenn";
  15. $msg .= "$messagenn";
  16.  
  17. mail($to, $subject, $msg, "From: My web sitenReply-To: $emailn");
  18.  
  19. ?>


Just be sure the flash movie code is set up to pass all of those to the script.

Reply With Quote
  #7  
Old February 14th, 2004, 01:23 AM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: email form won't work

You'll find a working Flash+PHP mail code here.

Reply With Quote
  #8  
Old February 18th, 2004, 03:26 PM
bass 305 bass 305 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 bass 305 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: RE: email form won't work

thanks but my host told me that i need authentication for sending the mail and gave me this code which i have customized but it won't wor either:

<?php
// Works for windows and UNIX plain text format
// The file class.smtp.inc does NOT nedd changes.
// The PHP has to be modified to accept
// the variables from HTML form.

include('class.smtp.inc');
header('Content-Type: text/plain');

// Put all HTML variables over $message.

$hoy = date ("d F Y");
$tel = $_POST['tel'];
$nombre = $_POST['nombre'];
$comentarios = $_POST['comentarios'];
$message = "ttt$hoynn";
$message .= "Nombre: $nombren";
$message .= "Telefono: $telnn";
$message .= "Comentarios:n";
$message .= "$comentariosnn";
$message .= "Operaciones Prodigy Hosting.";


/***************************************
** Setup some parameters which will be
** passed to the smtp::connect() call.
***************************************/
$params['host'] = '200.57.129.3'; // No cambiar , smtp.prodigyhosting.com
$params['port'] = '25'; // The smtp server port
$params['helo'] = 'guss-roch.com.mx'; // Su dominio.
$params['auth'] = 'TRUE'; // Whether to use basic authentication or not
$params['user'] = 'proyectos@guss-roch.com.mx'; // Username for authentication (no usar el de webmaster por seguridad)
$params['pass'] = 'gusrochp'; // Password for authentication

/***************************************
** These parameters get passed to the
** smtp->send() call.
***************************************/

$send_params['recipients'] = array('proyectos@guss-roch.com.mx'); // The recipients (can be multiple), separados por coma.

$send_params['headers'] = array(
'From: "pruebas@amatech_pruebas.com" <pruebas@amatech_pruebas.com>', // Headers
'To: proyectos@guss-roch.com.mx', 'Subject: Envio de Correo de PHP'
);

$send_params['from'] = 'pruebas@amatech_pruebas.com'; // This is used as in the MAIL FROM: cmd
// It should end up as the Return-Path: header
$send_params['body'] = '$message'; //Message // The body of the email


/***************************************
** The code that creates the object and
** sends the email.
***************************************/

if(is_object($smtp = smtp::connect($params)) AND $smtp->send($send_params)){
Header("Location: www.guss-roch.com.mx/cgi-bin/ok.htm");
exit;

// Any recipients that failed (relaying denied for example) will be logged in the errors variable.
//print_r($smtp->errors);

}else{
Header("Location: http://www.guss-roch.com.mx/cgi-bin/bad.htm");
exit;

// The reason for failure should be in the errors variable
//print_r($smtp->errors);
}

?>




ALSO THIS ONE which is inside class.smtp.inc







<?php
/***************************************
** Filename.......: class.smtp.inc
** Project........: SMTP Class
** Version........: 1.0.4
** Last Modified..: 05 December 2001
***************************************/

define('SMTP_STATUS_NOT_CONNECTED', 1, TRUE);
define('SMTP_STATUS_CONNECTED', 2, TRUE);

class smtp{

var $authenticated;
var $connection;
var $recipients;
var $headers;
var $timeout;
var $errors;
var $status;
var $body;
var $from;
var $host;
var $port;
var $helo;
var $auth;
var $user;
var $pass;

/***************************************
** Constructor function. Arguments:
** $params - An assoc array of parameters:
**
** host - The hostname of the smtp server Default: localhost
** port - The port the smtp server runs on Default: 25
** helo - What to send as the HELO command Default: localhost
** (typically the hostname of the
** machine this script runs on)
** auth - Whether to use basic authentication Default: FALSE
** user - Username for authentication Default: <blank>
** pass - Password for authentication Default: <blank>
** timeout - The timeout in seconds for the call Default: 5
** to fsockopen()
***************************************/

function smtp($params = array()){

if(!defined('CRLF'))
define('CRLF', "rn", TRUE);

$this->authenticated = FALSE;
$this->timeout = 5;
$this->status = SMTP_STATUS_NOT_CONNECTED;
$this->host = 'localhost';
$this->port = 25;
$this->helo = 'localhost';
$this->auth = FALSE;
$this->user = '';
$this->pass = '';
$this->errors = array();

foreach($params as $key => $value){
$this->$key = $value;
}
}

/***************************************
** Connect function. This will, when called
** statically, create a new smtp object,
** call the connect function (ie this function)
** and return it. When not called statically,
** it will connect to the server and send
** the HELO command.
***************************************/

function &connect($params = array()){

if(!isset($this->status)){
$obj = new smtp($params);
if($obj->connect()){
$obj->status = SMTP_STATUS_CONNECTED;
}

return $obj;

}else{
$this->connection = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
//if(function_exists('socket_set_timeout')){
// socket_set_timeout($this->connection, 5, 0);
//}

$greeting = $this->get_data();
if(is_resource($this->connection)){
return $this->auth ? $this->ehlo() : $this->helo();
}else{
$this->errors[] = 'Failed to connect to server: '.$errstr;
return FALSE;
}
}
}

/***************************************
** Function which handles sending the mail.
** Arguments:
** $params - Optional assoc array of parameters.
** Can contain:
** recipients - Indexed array of recipients
** from - The from address. (used in MAIL FROM,
** this will be the return path
** headers - Indexed array of headers, one header per array entry
** body - The body of the email
** It can also contain any of the parameters from the connect()
** function
***************************************/

function send($params = array()){

foreach($params as $key => $value){
$this->set($key, $value);
}

if($this->is_connected()){

// Do we auth or not? Note the distinction between the auth variable and auth() function
if($this->auth AND !$this->authenticated){
if(!$this->auth())
return FALSE;
}

$this->mail($this->from);
if(is_array($this->recipients))
foreach($this->recipients as $value)
$this->rcpt($value);
else
$this->rcpt($this->recipients);

if(!$this->data())
return FALSE;

// Transparency
$headers = str_replace(CRLF.'.', CRLF.'..', trim(implode(CRLF, $this->headers)));
$body = str_replace(CRLF.'.', CRLF.'..', $this->body);
$body = $body[0] == '.' ? '.'.$body : $body;

$this->send_data($headers);
$this->send_data('');
$this->send_data($body);
$this->send_data('.');

$result = (substr(trim($this->get_data()), 0, 3) === '250');
//$this->rset();
return $result;
}else{
$this->errors[] = 'Not connected!';
return FALSE;
}
}

/***************************************
** Function to implement HELO cmd
***************************************/

function helo(){
if(is_resource($this->connection)
AND $this->send_data('HELO '.$this->helo)
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){

return TRUE;

}else{
$this->errors[] = 'HELO command failed, output: ' . trim(substr(trim($error),3));
return FALSE;
}
}

/***************************************
** Function to implement EHLO cmd
***************************************/

function ehlo(){
if(is_resource($this->connection)
AND $this->send_data('EHLO '.$this->helo)
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){

return TRUE;

}else{
$this->errors[] = 'EHLO command failed, output: ' . trim(substr(trim($error),3));
return FALSE;
}
}

/***************************************
** Function to implement RSET cmd
***************************************/

function rset(){
if(is_resource($this->connection)
AND $this->send_data('RSET')
AND substr(trim($error = $this->get_data()), 0, 3) === '250' ){

return TRUE;

}else{
$this->errors[] = 'RSET command failed, output: ' . trim(substr(trim($error),3));
return FALSE;
}
}

/***************************************
** Function to implement QUIT cmd
***************************************/

function quit(){
if(is_resource($this->connection)
AND $this->send_data('QUIT')
AND substr(trim($error = $this->get_data()), 0, 3) === '221' ){

fclose($this->connection);
$this->status = SMTP_STATUS_NOT_CONNECTED;
return TRUE;

}else{
$this->errors[] = 'QUIT command failed, output: ' . trim(substr(trim($error),3));
return FALSE;
}
}

/***************************************
** Function to implement AUTH cmd
***************************************/

function auth(){
if(is_resource($this->connection)
AND $this->send_data('AUTH LOGIN')
AND substr(trim($error = $this->get_data()), 0, 3) === '334'
AND $this->send_data(base64_encode($this->user)) // Send username
AND substr(trim($error = $this->get_data()),0,3) === '334'
AND $this->send_data(base64_encode($this->pass)) // Send password
AND substr(trim($error = $this->get_data()),0,3) === '235' ){

$this->authenticated = TRUE;
return TRUE;

}else{
$this->errors[] = 'AUTH command failed: ' . trim(substr(trim($error),3));
return FALSE;
}
}

/***************************************
** Function that handles the MAIL FROM: cmd
***************************************/

function mail($from){

if($this->is_connected()
AND $this->send_data('MAIL FROM:<'.$from.'>')
AND substr(trim($this->get_data()), 0, 2) === '250' ){

return TRUE;

}else
return FALSE;
}

/***************************************
** Function that handles the RCPT TO: cmd
***************************************/

function rcpt($to){

if($this->is_connected()
AND $this->send_data('RCPT TO:<'.$to.'>')
AND substr(trim($error = $this->get_data()), 0, 2) === '25' ){

return TRUE;

}else{
$this->errors[] = trim(substr(trim($error), 3));
return FALSE;
}
}

/***************************************
** Function that sends the DATA cmd
***************************************/

function data(){

if($this->is_connected()
AND $this->send_data('DATA')
AND substr(trim($error = $this->get_data()), 0, 3) === '354' ){

return TRUE;

}else{
$this->errors[] = trim(substr(trim($error), 3));
return FALSE;
}
}

/***************************************
** Function to determine if this object
** is connected to the server or not.
***************************************/

function is_connected(){

return (is_resource($this->connection) AND ($this->status === SMTP_STATUS_CONNECTED));
}

/***************************************
** Function to send a bit of data
***************************************/

function send_data($data){

if(is_resource($this->connection)){
return fwrite($this->connection, $data.CRLF, strlen($data)+2);

}else
return FALSE;
}

/***************************************
** Function to get data.
***************************************/

function &get_data(){

$return = '';
$line = '';
$loops = 0;

if(is_resource($this->connection)){
while((strpos($return, CRLF) === FALSE OR substr($line,3,1) !== ' ') AND $loops < 100){
$line = fgets($this->connection, 512);
$return .= $line;
$loops++;
}
return $return;

}else
return FALSE;
}

/***************************************
** Sets a variable
***************************************/

function set($var, $value){

$this->$var = $value;
return TRUE;
}

} // End of class
?>



ANYBODY please help

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > email form won't work


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |