Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 January 8th, 2004, 06:00 PM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with sending e-mails - please help

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 = "[email protected]";
$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

 
Old January 8th, 2004, 06:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What's your register_globals set to?
 http://p2p.wrox.com/archive/beginnin...2002-11/17.asp


Take care,

Nik
http://www.bigaction.org/
 
Old January 9th, 2004, 04:00 AM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old January 9th, 2004, 04:24 AM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
sending e-mails How To?? saudyonline General .NET 13 November 17th, 2006 01:00 AM
sending mails arabuafef Classic ASP Basics 0 July 18th, 2006 06:29 AM
Sending mails. rupen Javascript How-To 1 October 25th, 2005 07:22 AM
Sending e-mails using C# lily611 General .NET 3 June 30th, 2004 05:46 AM
Sending mails rajeshnerenki Pro VB 6 4 September 25th, 2003 03:34 AM





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