php Mail script does not work


The php mail script doesn’t work while i am host server. That script i have already work in linux server that time it’s work but here doesn’t work. I have mentioned below what i have done in mail script in php. $to = ‘’; $subject = ‘Contact Form Submitted.’; $body = "Name: “working”; $email=‘’;

$mailchk = mail($to, $subject, $body, $email); if($mailchk) {

	echo "<script> alert('Activated Successfully. Kindly Check your Mail');</script>";
   	echo "<script> alert('error');</script>";


can you help me…

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Do you have an MTA installed? What’s the output of <pre>sudo netstat -plutn | grep 25</pre>? If it’s empty, run the following command: <pre>sudo apt-get install sendmail</pre>

function sendMail($to, $subject, $message,$from) <br> { <br> $headers = ‘From:’. $from . “\r\n” . <br> ‘Reply-To:’. $from . “\r\n” . <br> ‘X-Mailer: PHP/’ . phpversion(); <br> <br> if(mail($to, $subject, $message, $headers)) <br> return TRUE; <br> else <br> return FALSE; <br> } <br> <br>Here is a simple wrapper