Welcome to WebmasterWorld Guest from 107.21.175.43

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

We keep getting a PHP error message on this

email script / program that keeps crashing

     

SEO practioner

11:10 pm on Jul 3, 2003 (gmt 0)

10+ Year Member



So far, 3 of us have spent time on this but and we just can't seem to focus on where it is we must have strayed along in the code. Here's a copy 'n paste of the PHP code of our program. Lots of comments are written in french, I hope that doesn't discourage you.

If you have any questions (as to the french stuff), pls just sticky me and I will gladly respond.

- - - - - - - - - - - -

The error message reads:

Warning: Failed to Connect in c:\program_files\easyphp\www\our_site\valide_i.php on line 77

(It is acting as if it were a server error but its not. We are using localhost. The application isn't deployed yet).

------------------

<?php

<modnote>trimmed to relevant code only, as per charter

if ($erreur==0){
// envoie d'un email avec le nom d'usager et le courriel

$sujet= "Demande d'information\n";
$messager="Bonjour,<br>Votre nom d'usager est : $user<br> Votre mot de passe est : $password\n";

echo "$a<br>"."$sujet<br>"." $messager<br>"."$header<br>";

mail($a,$sujet,$messager,$header);
$mess="Un courriel vous<br>sera envoyé";
//redirect("index.php?message=$mess;");
//mail($adressedest,$lobjet,$lemessage,"From: $expediteur\nReply-To: $expediteur\nX-Mailer: PHP/" );
}else {
// initialisation du message
$mess="Donnée invalide, recommencer ou contacter nous";

//redirection vers la page du formulaire login
redirect("info_log.php?message=$mess;");
}
?>

- - - - - - - - - - - - - - - - -

Thanks to anybody that can pull us out of here.
:-)

[edited by: jatar_k at 11:49 pm (utc) on July 3, 2003]
[edit reason] generalized email addresses [/edit]

eaden

11:21 pm on Jul 3, 2003 (gmt 0)

10+ Year Member



I think on a windows server you have to specify smtp server in php.ini

also are you running a mysql server locally?

[edited by: eaden at 11:22 pm (utc) on July 3, 2003]

jatar_k

11:21 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



which is line 77?

and the french works as well as the english, I'm from Pointe Claire after all. ;)

jatar_k

11:30 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



two things from php.net

[ca.php.net...]

The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine). Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP. PHP < 4.3 only supported the Cc: header element (and was case-sensitive). PHP >= 4.3 supports all the mentioned header elements and is no longer case-sensitive.

2 important php.ini settings for windows

[ca.php.net...]

SMTP string

Used under Windows only: DNS name or IP address of the SMTP server PHP should use for mail sent with the mail() function.
smtp_port int

Used under Windows only: Number of the port to connect to the server specified with the SMTP setting when sending mail with mail(); defaults to 25. Only available since PHP 4.3.0.

SEO practioner

11:38 pm on Jul 3, 2003 (gmt 0)

10+ Year Member



Hi guys! Wow... great responses

1- Eaden, yes we are running it locally on a windows machine. Once it is deployed, it will be on one of our Linux servers.

2- Jatar_K - I didn't know you were in the Montreal area... wow.

Line 77 is this one: mail($a,$sujet,$messager,$header);

Jatar: the last paragraph from PHP Net makes a lot of sense. But does it still apply to us even if we are just running everything locally? Nothing is online yet. If it were, I would understand the error message, but its not.

But it would make sense Jatar

Your toughts?

Thanks

jatar_k

11:53 pm on Jul 3, 2003 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



In Vancouver these days but my family still lives in Pointe Claire and I visit as often as I can (it will always be home ;)).

I figure, as eaden also mentioned, that it has no idea where or how to connect to the smtp server and that is what the problem is.

You can probably set it to the actual SMTP server that it will use (as long as it can connect to it) and that will make it easier when you do put it live.

SEO practioner

12:15 am on Jul 4, 2003 (gmt 0)

10+ Year Member



Ok Jatar, thanks!

I will set it up with our smtp server ans it will be all setup when we do put it online in a few days.

Well take care there in Vancouver Jatar. Do you like Vancouver too? I was there a few times on assignements and loved it!

thanks :-)
SEO

 

Featured Threads

Hot Threads This Week

Hot Threads This Month