email - How to check mail send success or not when using mail() PHP? -


this question has answer here:

how check mail send success or not when using mail() php ?

i use code send mail user , want know how can check send mail status success or not on code ?

<?php include("connect.php"); $to      = "test@example.com"; $subject = "subject"; $message = "message"; $headers  = 'mime-version: 1.0' . "\r\n";  $headers .= 'content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'from: exmaple <noreply@example.com>' . "\r\n"; $headers .= 'return-path: return@example.com' . "\r\n"; mail($to, $subject, $message, $headers, '-freturn@example.com'); ?> 

something this.

if(@mail($emailrecipient, $subject, $message, $headers))     {       echo "mail sent successfully";     }else{       echo "mail not sent";     } 

from docs

returns true if mail accepted delivery, false otherwise.

it important note because mail accepted delivery, not mean mail reach intended destination.


Comments

Popular posts from this blog

Redirect to a HTTPS version using .htaccess -

Unlimited choices in BASH case statement -

javascript - jQuery: Add class depending on URL in the best way -