SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unable to send PHP mail...

    I'm trying to send an email when a user submits a form post, it adds the info to the database then emails an administrator to alert them to "ok" the story before its posted live. The problem is its not sending the email. Here is the email portion of code:
    PHP Code:
            $email "admin@admin.com";
            
            
    $subject "Website: News Story needs review/activation.";
            
    $message "
            There has been a news item submitted for review. Please follow this link to edit and activate:
            http://www.linktonews.com
            
            Thank you!"
    ;
                
            
    mail($email$subject$message
                
    "From: Website Admin <noreply@admin.com>\n" ); 
    Could it not be sending because of the server setup itself or could this be a php.ini issue? Any input would be appreciated.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    is it on your local machine or a web server? if on the web, contact your webmaster / hosts.

    Alot of hosts only allow PHP mail on a Linux server
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's on a windows server 2000 machine running IIS5. I have setup the web server and I'm not sure if it is setup correctly to send emails.

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone have any ideas? I'm completely stuck on this one.

  5. #5
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I used to have a similar problem. Have you defined a smtp server in php.ini?

  6. #6
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mm... this is usually a problem with windows server. PHP mail is usually blocked on windows server and they are forced to use SMTP mail . You may need to check with your web hosting company to find out more details on what they actually have for mail sending...

  7. #7
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even if it's setup properly, it could very well be sending mail, but it isn't reaching it's destination due to spam filtering. The mail function all by itself rarely works anymore. You almost always have to add additional headers, with your message once you are sure the software is working properly.

  8. #8
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your script is fine.

    http://www.lionslair.net.au/test/sit...pic_498705.php

    it is your configuration then.

  9. #9
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried any other php pages. LIke a simple echo function or whatever just to see if the server is parsing php. If it is then its a mail sending config problem... 2cs
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  10. #10
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes the server parses PHP just fine. it's gotta be on the server side i assume

  11. #11
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    Thats whats in my php.ini file. I have a feeling localhost isnt correct. Any ideas what to change it to?

  12. #12
    SitePoint Wizard Hammer65's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln Nebraska
    Posts
    1,161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    localhost is fine if there is an SMTP service running on that machine, otherwise it has to be an external server address.

  13. #13
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do not believe I have SMTP setup. Is there a tutorial on how to set that up?

    Also, how could I point it to an external SMTP server? This seems like the easier solution as I have another website that I do not host with SMTP all setup.


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
  •