Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2002
    Location
    Ohio
    Posts
    3,139

    Question PHP mail script isnt sending mail?

    I'm working on an error checking system, but it appears that the mail function isnt working right. It's not sending anything.

    Here is my mail code:
    PHP Code:
    mail("email_address""my subject"$message"From: name <[email protected]>"); 
    Is there any other ways I can test this?

    This script used to work fine, but it appears it isnt working now.
    Glioblastoma Multiforme (GBM) Brain Cancer Awareness. May is Brain Cancer awareness month. Gray Matters!
    Incurable, 6-18 months prognosis, survivors longer than 3 years less than 1% chance.
    Don't like what I say? Ignore me.

  2. #2
    Join Date
    Mar 2004
    Location
    Granville OH
    Posts
    108
    php mail requires that sendmail (or some interface that looks like sendmail) is available to php. You could try going to the shell to see if you can use sendmail directly. If you have no shell access you should ask your provider about the problem.

  3. #3
    Join Date
    Aug 2002
    Location
    USA
    Posts
    373
    Some email servers require the "-f" parameter to be sent with email calls from PHP.
    Jamie
    RadicalV.com High Velocity Hosting Services - Since 1999
    Hsphere Linux & Windows Hosting ~ Automated Reseller Plans ~ EasyApp Collection

  4. #4
    Join Date
    Nov 2003
    Location
    Earth
    Posts
    273
    I have same problem on Windows 2003 box, what should I do to get rid of this problem?

  5. #5
    Join Date
    Jul 2003
    Location
    Kuwait
    Posts
    5,099
    on Windows, you need to set your SMTP server in php.ini before mail() will work.

    Also note that if your SMTP is not the same box as the webserver, and it requires authentication before sending -- then mail() does not work (for both Windows and Unix/Linux).

    In either case, I would suggest using phpmailer or any number of mail classes that don't use sendmail.
    In order to understand recursion, one must first understand recursion.
    If you feel like it, you can read my blog
    Signal > Noise

  6. #6
    Join Date
    Mar 2004
    Location
    Connecticut, USA
    Posts
    264
    I believe it uses the same idea as a "send form" in HTML. It needs to either access the server's SMTP or a CGI script.
    - Chris
    [email protected]
    www.totalmindblow.com
    www.theundergroundfiles.com

  7. #7
    I had a problem slightly similar to that. PHP was compilted without MAIL. Solution would ofcourse be to recompile php - but you can also just contact directly to your smtp server when sending mail:

    http://www.hotscripts.com/Detailed/12246.html

    This way you can send mail from a php script without using mail()


    EDIT: Ooops I didnt notice that fyrestrtr had answered with a tip like this :/

  8. #8
    hmm lets see if i can remember this..

    PHP Code:
    mail("$to""$subject""$message""From: $from"); 
    i hope that works better

Posting Permissions

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