Subject: Problems with sending e-mails - please help
Posted By: t@mzk Post Date: 1/8/2004 5:00:39 PM
Hi!

I'm trying to get customer information through an html form (text field) to my e-mail, but all I get is empty e-mails. I've checked the variables. The variables are taken from the html and are used in php script, both in lowercase format.

Here's my script:

<?php
$firstname = HTMLSpecialChars($firstname);
$lastname = HTMLSpecialChars($lastname);
$email = HTMLSpecialChars($email);
$address = HTMLSpecialChars($address);
$city = HTMLSpecialChars($city);
$zipcode = HTMLSpecialChars($zipcode);
$phone = HTMLSpecialChars($phone);
$textarea = HTMLSpecialChars($textarea);

$email  =  strtolower($email);

$mail_to = "myemail@myprovider.com";
$mail_subject = "Customer info";
$mail_body = "$firstname \n";
$mail_body  .= "$lastname\n";
$mail_body  .= "$email \n";
$mail_body  .= "$address \n";
$mail_body  .= "$city \n";
$mail_body  .= "$zipcode \n";
$mail_body  .= "$phone \n";
$mail_body  .= "$textarea \n";
if (mail($mail_to, $mail_subject, $mail_body))
        echo "Success. Thank you!";
        else  echo "No success. Return and try again. Thank you!";
?>

Please help me solve this.

Thanx many times,

Teo

Reply By: nikolai Reply Date: 1/8/2004 5:17:17 PM
What's your register_globals set to?
 http://p2p.wrox.com/archive/beginning_php/2002-11/17.asp


Take care,

Nik
http://www.bigaction.org/
Reply By: t@mzk Reply Date: 1/9/2004 3:00:28 AM
Hi Nik,

It's set to On (rebooted). I've read that register_globals = On should be avoided, if possible, for security reasons. Is there then another way to use HTML->PHP variables?

(I still didn't figure out why are the e-mails empty. The script couldn't be simpler. Maybe that's the problem :)).

Many thanx,

Teo

Reply By: t@mzk Reply Date: 1/9/2004 3:24:02 AM
Nik, one more thing,

I have set IIS on my computer. As you know IIS has a SMTP local server. When I use the same script and send it to localhost, I get everything working and with no problems. I have also tried to change php.ini [mail_function] SMTP = my outgoing mail server provider. Before it was set to SMTP = localhost, but guess what, nothing happend. Why is it that I get email on my local server, and not when I upload it to a internet server?

Again, thank you. You are a big help!

Teo


Go to topic 8366

Return to index page 973
Return to index page 972
Return to index page 971
Return to index page 970
Return to index page 969
Return to index page 968
Return to index page 967
Return to index page 966
Return to index page 965
Return to index page 964