How do I set up a server to send email using cPanel?

I am trying to send an email using php. Mail returns true. But I get a letter. So my guess is that there might be a problem with the server. Is there any tutorial explaining how to configure the server to send email correctly using cPanel?

My code is below.

<?php

    $msg = "First line of text\nSecond line of text";
    $msg = wordwrap($msg,70);
    $headers = "From: test1@islamerkotha.com";
    mail("erfan.bashar.13@gmail.com", "My subject", $msg, $headers);

      

+3


source to share


1 answer


Hi you can first make sure your hosting provider allows you to send emails, try to see if their SMTP server is available, most hosting providers are available by default.



Here is a tutorial on setting up smtp using phpmailer Send mail using phpmailer

+2


source







All Articles