Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-23-2006, 06:04 PM mail() function
MZA
Experienced Talker

Posts: 47
Trades: 0
i am trying to make a contact page, but my code isn't working.

Code:
<?
$name = $_POST['name'];
$subject = $_POST['subject']; 
$email = $_POST['email']; 
$message = $_POST['message']; 

if (!$name) { 
echo "Please fill in the name field."; 
die;
} elseif (!$email) { 
echo "Please fill in the email field."; 
die;
} elseif (!$subject) { 
echo "Please fill in the subject field."; 
die;
} elseif (!$message) { 
echo "Please fill in the message field."; 
die;
} else { mail("hilltown.vids@gmail.com", $subject, $message, "From: $email\n$name" ); 
echo "Email sent successfully.";
}
?>
MZA is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-23-2006, 07:08 PM Re: mail() function
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
How exactly is it "not working"?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 06-23-2006, 09:50 PM Re: mail() function
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You are inquiring in your script sample if any of the givien strings equal false. The strings will not equal false because you copied the values of each from each $_POST. If they are empty, they will still return true.

Use: if (trim($name) != '') instead.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 06:23 PM Re: mail() function
MZA
Experienced Talker

Posts: 47
Trades: 0
i took out the verification part for right now, i just need the main code to work, so now i have:
PHP Code:
<?
$name 
$_POST['name'];
$email $_POST['email'];
$subject $_POST['subject'];
$message $_POST['message'];

mail("hilltown.vids@gmail.com"$subject$message"From: $email\n$name"); 
echo 
"Email sent successfully.";
?>
by not working i mean that i am not receiving any emails when i use it
MZA is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 09:11 PM Re: mail() function
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
You might need to check and setup the php.ini to connect to your mail service provider.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 06-25-2006, 10:55 PM Re: mail() function
ChancesAre's Avatar
Skilled Talker

Posts: 84
Trades: 0
You should check the return value of your mail function.


You may also wanna take a look in your BULK or SPAM forlders.
ChancesAre is offline
Reply With Quote
View Public Profile
 
Old 06-26-2006, 05:22 PM Re: mail() function
MZA
Experienced Talker

Posts: 47
Trades: 0
its returning false

and im on a free host so i dont have access to php.ini
MZA is offline
Reply With Quote
View Public Profile
 
Old 06-26-2006, 05:38 PM Re: mail() function
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
Free hosts usually have mail() disabled.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Old 06-29-2006, 04:39 PM Re: mail() function
MZA
Experienced Talker

Posts: 47
Trades: 0
is there any other way then?
MZA is offline
Reply With Quote
View Public Profile
 
Old 06-29-2006, 04:48 PM Re: mail() function
stOx's Avatar
Machine

Latest Blog Post:
Worlds Smallest Car - Peel P50
Posts: 2,111
Name: Matt. (>',')>
Location: London, England.
Trades: 0
you could connect to an SMTP server with PHP, But unless you have access to an SMTP server you wont be able to use this option either.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
stOx is offline
Reply With Quote
View Public Profile Visit stOx's homepage!
 
Reply     « Reply to mail() function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.06302 seconds with 12 queries