Jump to content


Photo

Disabling PHP Mail() invalid recipient error


  • Please log in to reply
3 replies to this topic

#1 qwave

qwave
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 09 June 2006 - 07:40 PM

I have a form on my website where the user registers his account, including email address. Once he submits the form, PHP executes the mail() function to send a confirmation email. However, if the user inputted an invalid address, the error message appears at the top of the page: "Warning: mail(): SMTP server response: 550 Invalid recipient: blahblah@fdshjfs.com in...."



I dont want the user to see this error message. I want to return a different error message and post it somewhere else on the page, such as "Invalid email address.". How can I make it so that mail() does not echo the error message to the immediete frame?

#2 qwave

qwave
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 June 2006 - 09:26 PM

Does anyone know the answer to this? =/

#3 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 10 June 2006 - 09:32 PM

You can use error supression:

if (!@mail(...)) {
   echo 'Mail not sent';
} else {
   echo 'Success';
}

~ D Kuang

#4 qwave

qwave
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 June 2006 - 09:47 PM

Brilliant! Worked like a charm, thanks so much.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users