If succesful

the mail() function

Moderators: macek, egami, gesf

nick_k
New php-forum User
New php-forum User
Posts: 34
Joined: Wed Dec 25, 2002 6:04 am
Location: The Netherlands
Contact:

If succesful

Postby nick_k » Sun Dec 29, 2002 12:25 pm

This is probably something really basic, but here goes anyway. How do I check to see if the mail(); function was succesful, for example, I was to: print("Message succesfully sent!");, if it was succesful.

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Re: If succesful

Postby Joan Garnet » Sun Dec 29, 2002 2:53 pm

Yes, it works like this :
mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

Have a look at http://www.php.net/manual/en/function.mail.php

Code: Select all

 if(mail($EMAIL, "$SUBJECT", "$BODY", "From: $REPLY")) { 
            echo "success"; 
 }else{
            echo "fail";
 }     



bye
:)
Last edited by Joan Garnet on Sun Dec 29, 2002 3:04 pm, edited 1 time in total.

nick_k
New php-forum User
New php-forum User
Posts: 34
Joined: Wed Dec 25, 2002 6:04 am
Location: The Netherlands
Contact:

Postby nick_k » Sun Dec 29, 2002 3:04 pm

thanks for the code!


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 0 guests

cron