how can i test mail() on my server to know it is working

how can i test mail() on my server to know it is working

i have hosting i sent message from mail :

$to = "$co_email";
$subject = "*****";
$txt = "set your password by this link :  http://********/setpassword.php";
$headers = "From: admin@*******" . "\r\n" . 
"CC: ************";

Open in new window

from my hosting done

another hosting failed

the same php 5.6
AHMED SAMYownerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You need to know if the server in question is allowed to send out emails, and if not, have the hosting company provide you with the correct info (other SMTP server)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Use the mail command on the command line or use sendmail directly, as most MTAs provide a sendmail wrapper.

Here's the thing though. Just because you can send email does not mean it will every be accepted or delivered.

Email sending + accepting (by external host) + delivery (on external host) are all three distinct operations.

If you've implemented all steps in my comments here, then you understand what's required to manage a native MTA. Keep in mind, you'll have to repeat these steps for each machine you use + each time you change hosting.

And you'll likely requires a few hours/day managing your return loop.

Or you can use a service like MailGun + you'll be setup in a few minutes with 100% deliverability + your code will work forever, independent of your runtime environment (hosting).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.