SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy PHP Mail does not work

    Has anyone had the problem where the mail() function would simply not work in PHP? I have configured my php.ini to the correct sendmail_path and I have tried to restart sendmail, but the mail function still won't work. I am running on CentOS5 has anyone had any similar problems?
    Have a good day.

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Only when mail for the domain was being handled by an external mail server, while sendmail was trying to route the message locally instead of doing an MX lookup. If your web server and mail server are the same box, then that's not it.

  3. #3
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884 View Post
    Has anyone had the problem where the mail() function would simply not work in PHP? I have configured my php.ini to the correct sendmail_path and I have tried to restart sendmail, but the mail function still won't work. I am running on CentOS5 has anyone had any similar problems?
    RU running on shared hosting account? If yes, most probably your hosting company might have disabled mail() function. I will advise you to contact your hosting company to check if mail() function is enabled?

  4. #4
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No this is a VPS account.
    Have a good day.

  5. #5
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,514
    Mentioned
    37 Post(s)
    Tagged
    1 Thread(s)
    Use swiftmailer and log the response to sending email via php native mail, then if that shows nothing check your raw mail logs (typically var/log/maillog) for any clues and try and send mail directly via a command line to check its functioning.

  6. #6
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884 View Post
    Has anyone had the problem where the mail() function would simply not work in PHP? I have configured my php.ini to the correct sendmail_path and I have tried to restart sendmail, but the mail function still won't work. I am running on CentOS5 has anyone had any similar problems?
    What is the error message coming when you're trying to send email ?

  7. #7
    SitePoint Addict
    Join Date
    Oct 2008
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check the email log , the exact error would be given and can be solved.
    ------------
    hzSari | HostingZoom.com
    ModVPS.com | ResellerZoom.com
    Power Speed Reliability

  8. #8
    SitePoint Wizard Darren884's Avatar
    Join Date
    Aug 2003
    Location
    Southern California, United States
    Posts
    1,616
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I moved to another server and now the email service will not install... I have decided to move to Google Apps.
    Have a good day.

  9. #9
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Darren884 View Post
    I moved to another server and now the email service will not install... I have decided to move to Google Apps.
    I doubt it will resolve your issue since mail() function is related to PHP and it has nothing to do with your email service. Please make sure your server is configured to allow emails only with SMTP authentication since mail() function does not use SMTP authentication to send emails.

  10. #10
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2nd the above.

    Don't use mail(). It's a spammers dream and it's so simple to use authorised smtp that you have no reason not to.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •