Current location: Hot Scripts Forums » Programming Languages » PHP » Simple PHP mail() question


Simple PHP mail() question

Reply
  #1 (permalink)  
Old 06-09-09, 09:45 PM
tommoxx tommoxx is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Simple PHP mail() question

Hi all,

I have a simple(?) problem with my contact form. It used to work on another server and with an older PHP version but currently I can not get my contact form to send out email.

mail() always return false.

I have changed the sript from the old extract($_REQUEST); to
extract($_POST);
$name = $_POST['name'];
$email= $_POST['email'];
and so on.

Then, at the end when I do
mail("info@mydomain.com", "Product-Inquiry", "$message", "From:$email");
it never works.

What else do I have to configure on the server (PHP is active, of course) or where can I look for further diagnostics.

Sorry, if this question is a bit silly, but I am in a rush and need to fix this quickly.

THANKS for your help in advance, greatly appreciated
Thomas

Last edited by tommoxx; 06-09-09 at 09:50 PM. Reason: taken personal detail out
Reply With Quote
  #2 (permalink)  
Old 06-10-09, 07:49 AM
therocket954's Avatar
therocket954 therocket954 is offline
Community Liaison
 
Join Date: Jul 2007
Location: Michigan, USA
Posts: 334
Thanks: 2
Thanked 8 Times in 8 Posts
Do you get any error message from your script?
__________________
--Eric Allison
Twitter: http://www.twitter.com/Eric_Allison
Reply With Quote
  #3 (permalink)  
Old 06-10-09, 08:27 AM
tommoxx tommoxx is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by therocket954 View Post
Do you get any error message from your script?
Hi Eric,

none on the site and nothing in errors.txt on the server....Where else can I look?

Thanks,

Thomas
Reply With Quote
  #4 (permalink)  
Old 06-11-09, 09:33 AM
Thyrosis's Avatar
Thyrosis Thyrosis is offline
Newbie Coder
 
Join Date: Dec 2008
Location: South UK
Posts: 66
Thanks: 2
Thanked 0 Times in 0 Posts
I got this from the PHP.net website, and adapted it a bit to hopefully suit you better:
PHP Code:

<?php
$to      
'info@mydomain.com';
$subject 'Product Enquiry';
// the message for some reason is not allowed more then 70 characters per line. 
// using the wordwrap function clears this issue
$message wordwrap($_POST['message'], 70);
$headers 'From: '.$_POST['name'].' <'.$_POST['email'].'>' "\r\n";

mail($to$subject$message$headers);
?>
Maybe this solves the problem?
Reply With Quote
  #5 (permalink)  
Old 06-12-09, 04:26 AM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
Make sure you are using full <?php tag and not <?

This was something that happened to a few of my sites when php was upped from 4 to 5.
__________________
Aye!
Reply With Quote
Reply

Bookmarks

Tags
mail), php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP or PHP which is better? nepala The Lounge 9 07-14-10 05:48 AM
A very simple php question insertnamehere PHP 13 10-03-05 03:22 PM
convert from html to php question ZviT PHP 1 07-07-05 07:32 AM
PHP Nuke question HopesDespair PHP 0 06-01-05 02:10 PM
converting perl script to php help!! macruddace Perl 1 04-14-05 02:38 PM


All times are GMT -5. The time now is 08:37 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.