Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 12th, 2003, 01:29 PM
Registered User
 
Join Date: Nov 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to thiagoholanda Send a message via MSN to thiagoholanda
Default How to redirect one server for other server?

Hello firends!

I have my PHP forms running in my server... but this server don't have the application SendMail that send the form's information.

I have other server that is running the SendMail. How i do for to redirect my forms for this server, if the forms are in other server?

Is there same source for this? Please, check my souce below:

<?php

if( $_POST )

{

$recipient = "[email protected]";



$subject = "Contato - Site Oficial da Nordah";



$headers = "From: $nome <$email>\n";

$headers .= "X-Sender: <$email>\n";

$headers .= "X-Mailer: PHP ".phpversion()."\n"; // mailer

$headers .= "Return-Path: <[email protected]>\n"; // Return path for errors

$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // Mime type



$imprime = "De: $nome\n";

$imprime .= "Email: $email\n";

$imprime .= "Titulo: $titulo\n\n";

$imprime .= "Mensagem: $mensagem\n";



mail($recipient, $subject, $imprime, $headers);



?>

<script type="text/javascript">

alert( 'Mensagem enviada com sucesso!' );

</script>

<?php } ?>

<script type="text/javascript">

function critica()

{

    with( document.form1 )

    {

        if( nome.value == "" )

        {

            alert( 'Entre com o seu nome' );

            nome.focus();

            return false;

        }

        if( email.value == "" )

        {

            alert( 'Entre com o seu email' );

            email.focus();

            return false;

        }

        if( titulo.value == "" )

        {

            alert( 'Entre com o titulo da mensagem' );

            titulo.focus();

            return false;

        }

        if( mensagem.value == "" )

        {

            alert( 'Entre com a mensagem' );

            mensagem.focus();

            return false;

        }

    }

    return true;

}

function clean()

{

    with( document.form1 )

    {

        nome.value = "";

        email.value = "";

        titulo.value = "";

        mensagem.value = "";

        nome.focus();

    }

}

</script>

Thiago Holanda
WebDeveloper
Nordah Informática
http://www.nordah.com
Tel: (21) 3852-8425
Cel.: 9629-2673
 
Old November 12th, 2003, 03:43 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Well you don't necessarily have to redirect traffic to another server because one doesn't have sendmail. You can use an SMTP mailer class. Which would connect to whatever SMTP server that you specify and send the message.

Lots of open source solutions out there:
http://www.google.com/search?q=SMTP+Mail+class+php

If you are determined to redirect to another server to use a mailer you can use the header() function or redirect on the client-side with JavaScript.

header("Location: http://www.someserver.com");
http://www.php.net/header

This function alters the outgoing HTTP response headers from the server, because of this, this function must be called before any output from a script from echo, print. And the opening <?php delimiter may not have whitespace or content before it.

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
Diff bet Response.Redirect and Server.Transfer alienaheart ASP.NET 1.0 and 1.1 Basics 1 October 2nd, 2008 12:51 AM
Server.Transfer vs. Response.Redirect mikener BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 2 April 10th, 2008 04:18 PM
Redirect inside a Server Control Button Andrew_S ASP.NET 2.0 Basics 1 April 19th, 2006 01:43 PM
Server.Transfer and Response.redirect lavanyarl ASP.NET 1.x and 2.0 Application Design 1 November 9th, 2004 03:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.