SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: php mail

  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php mail

    Hi,

    I have a mail function within my site which an error occurs when sending the mail (yes i have not setup the PHP.ini file yet which is the problem). BUT I want to be able to stop all errors being printed out e.g.
    if(mail(works))
    {
    yes it worked
    }
    Else
    {
    sorry tech difficulties
    }

    Any Ideas
    Regards
    p_h_p

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    if(@mail(works))

    the @ surpresses php errors and doesn't display them
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the Error Control Operator
    PHP Code:
    if(@mail(works))
    {
    //yes it worked
    }
    Else
    {
    //sorry tech difficulties


  4. #4
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Edit:
    Sorry for stepping on you, spike . Couldn't notice you quick enough.

  5. #5
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Better yet, turn display_errors off when in production and set an error log.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  6. #6
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers - i never assumed the @ sign would work for mail i use it for db connections.

    never thought of turning off the error reports - am i right in thinking error_reporting(0); should do the trick as the host maybe reluctant to alter the php.ini file.


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
  •