Link to home
Start Free TrialLog in
Avatar of AHMED SAMY
AHMED SAMYFlag for Egypt

asked on

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 godaddy.com i sent message from mail :

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

Open in new window


from my hosting done

another hosting failed

the same php 5.6
ASKER CERTIFIED SOLUTION
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 https://www.experts-exchange.com/questions/29036679/AWS-EC2-mail-server.html, 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).