coure2011
coure2011

Reputation: 42394

simple form to send email

I want to show whether email sent successfully or failed on the same form. I want to show the empty form after email sent successfully. How can i do it? here is the form

<input type="text" name="name" />
<input type="text" name="email" />
<input type="submit" name="submit" />
<span>here i want to show msg<span>

Upvotes: 0

Views: 283

Answers (2)

DLH
DLH

Reputation: 2821

mail() will return TRUE "if the mail was successfully accepted for delivery", so I guess have the form submit to the same page, handle the data using PHP at the top, save the return value of the mail() function in a variable, and handle that boolean value in that variable in order to display what you want to display.

Upvotes: 1

Sergey
Sergey

Reputation: 21151

php mail()

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
this will help. There are some examples.
Remember! accepted for delivery is NOT the same as Delivered!

Upvotes: 2

Related Questions