Forum Moderators: coopster

Message Too Old, No Replies

Problem when using PHP for sending e-mail

the server stucks on the php file

         

yanov

5:11 pm on Oct 8, 2004 (gmt 0)

10+ Year Member



I have a site and I use PHP for sending mails from the site to my e-mail address. The file that is used for sending is called sendmail.php .When I Fill in the form and click "send" it starts sending it but the process continues about 5 mins. I use Iexplorer and when I press "send" in the status bar is displayed the "sendmail.php" file. It takes 5 mins to send the mail and to go to the "your-mail-is-successfully-sent" page. It just stucks on this file. Does somebody knows what is the problem? I would be very thankful if you help me.
Thank you.

Adrian2k4

6:49 am on Oct 9, 2004 (gmt 0)

10+ Year Member



how about posting you code?

yanov

10:01 am on Oct 9, 2004 (gmt 0)

10+ Year Member



This is sendmail.php:
"<?php

require_once("sendmail-conf.php");

$request = $_REQUEST;

$to = $GLOBALS[SENDMAIL_TO];
$from;
$subject;
$message;

$text = "";
foreach ($request as $key => $value)
{
if(substr($key, 0, 2)!= "x-")
{
$text .= "$key: $value\n";
}
}

$from = "$firstname $lastname <$email>";
$subject =
$request["x-subject-prefix"] . " " .
$request[$request["x-subject-field-1"]] . " " .
$request[$request["x-subject-field-2"]] . " " .
$request[$request["x-subject-field-3"]] . " " .
$request[$request["x-subject-field-4"]] . " " .
$request["x-subject-sufix"];
$message = $text;
$success = $request["x-success"];
$failure = $request["x-failure"];

/*
print "TO:" . $to . "<BR><BR>";
print "FROM: " . $from . "<BR><BR>";
print "SUBJECT: " . $subject . "<BR><BR>";
print "MESSAGE:<BR>" . $message . "<BR><BR>";
print "Success: " . $success . "<BR><BR>";
print "Failure: " . $failure . "<BR><BR>";
*/

$headers = "";
$headers .= "From: $from\n\r";

$result = mail($to, $subject, $message, $headers);
if($result == TRUE)
{
//print("$to: success");
header("Location: $success");
}
else
{
//print("$to: failure");
header("Location: $failure");
}

?>
"

AND THIS IS sendmail-conf.php
"<?php

$SENDMAIL_TO = "me@example.com";

?>
"

[edited by: jatar_k at 5:01 pm (utc) on Oct. 9, 2004]
[edit reason] generalized email [/edit]

coopster

2:20 pm on Oct 11, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If it is indeed successfully processing the script and sending the email then you'll have to start checking things out on the server side.

yanov

4:07 pm on Oct 11, 2004 (gmt 0)

10+ Year Member



That is what I said to the webmaster of the host. But he haven't corrected it. He may be incompetent in this sphere. :)).
Thank you anyway.