UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > Linux Dedicated Servers

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-12-2007, 10:22
Member
 
Join Date: Nov 2007
Posts: 45
Default Using PHP Mail() command

Hi there,

Is there anything special I need to do to ensure I can use the mail() function in PHP.

I'm trying to run a very simple 3 line script sending myself an email. The script is confirming the email has been sent ... but it doesn't seem to turn up in my inbox.

Thanks alot
Reply With Quote
  #2 (permalink)  
Old 10-12-2007, 10:35
developmentxl's Avatar
Member
 
Join Date: Nov 2007
Location: Edinburgh
Posts: 64
Default

Hey,

There are quite a number of reasons this could be happening, but first of all I'd double check to make sure the mail() function is returning True - if you haven't already ...

PHP Code:
if(mail(your mail parameters)) { 
    echo 
"It works!"
} else {
     echo 
"Failed :("

Reply With Quote
  #3 (permalink)  
Old 10-12-2007, 10:37
Member
 
Join Date: Nov 2007
Posts: 45
Default

Thanks developmentxl - that's what I'm trying at the moment.

The if() statement's returning true and the "Mail sent!" message is displaying on the screen. So there doesn't appear to be a problem with the code ... which is why I thought that maybe I needed to configure something on the server.
Reply With Quote
  #4 (permalink)  
Old 10-12-2007, 10:51
developmentxl's Avatar
Member
 
Join Date: Nov 2007
Location: Edinburgh
Posts: 64
Default

Hia,

I recently had a similar problem and it turned out my mail was being blocked by spam filters at various recipients and it just seemed to take a while to get through to others (a few hours in some cases!)

If you are on a VPS or Dedicated you can nip into WHM and check the mail queue, see if your mail is sitting there, or run the Mail troubleshooter.

Otherwise I'm afraid this one is down to the support team, not much more I can suggest I'm afraid apart from list a few issues that has stopped mail() reaching it's final destination for me in the past;
  • No reverse DNS on my server's IP,
  • No SPF record on my domain's DNS zone,
  • Oh, and of course, incorrect email address syntax
Reply With Quote
  #5 (permalink)  
Old 10-12-2007, 11:19
eUKhost.com's Avatar
Chief Marketing Officer
 
Join Date: Sep 2005
Posts: 4,261
Send a message via AIM to eUKhost.com Send a message via MSN to eUKhost.com
Default

Quote:
Originally Posted by MortimerJazz View Post
Thanks developmentxl - that's what I'm trying at the moment.

The if() statement's returning true and the "Mail sent!" message is displaying on the screen. So there doesn't appear to be a problem with the code ... which is why I thought that maybe I needed to configure something on the server.
If you can provide us with some details in a ticket then one of our staff member will try couple of options and find out whats wrong with the script or server settings. Making any sort of predictions over here wont be possible as can be many different possibilities for such problem.
__________________
UK Web Hosting || Business Hosting || eUKhost Knowledgebase
Toll Free : 0808 262 0255 || MSN : mark @ eukhost.com || AIM : eukmark
A bunch of Sheep led by a Lion is better than a bunch of Lions led by a Sheep.
__________________________________________________

Great Opportunity :: Join our Affiliate Program for FREE and earn 20% commission on each referral.
Reply With Quote
Reply



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

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


All times are GMT. The time now is 16:08.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

knowledgebase articles

popular blog categories