Is there a way to check with PHPUnit (or perhaps another testing framework for PHP) if the mail was sent correctly?
If you want to check if mail was sent successfully, you do not need phpunit, you just do:
mail(.....) or die('Could not send the email !!');
or
if (!mail(......)){ echo 'Could not send the email !!'; }
Note that this tells you whether the mail was sent, whether it was received, to whom the email was sent. Therefore, the best term here should be delivered .
Sarfraz
source share