title: Can't send server emails in CodeIgniter 4
body: <p>I just hanged up to send server emails.</p>
  
  <p>I'm preparing email sending code like this:</p>
  
  <pre><code>$email_config = Array(
      'charset' =&gt; 'utf-8',
      'mailType' =&gt; 'html'
  );
  
  $email = \Config\Services::email();
  $email-&gt;initialize($email_config);
  
  $email-&gt;setNewline("\r\n");
  $email-&gt;setCRLF("\r\n");
  $email-&gt;setFrom("test@mysite.com", "Sender name");
  
  $email-&gt;setTo("receiver@gmail.com");
  $email-&gt;setSubject("Test message");
  $email-&gt;setMessage("Hello");
  
  if ($email-&gt;send()) {
      echo "Email sent!";
  } else {
      echo $email-&gt;printDebugger();
      return false;
  }
  </code></pre>
  
  <p>It's showing this error message:</p>
  
  <pre><code>Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
  Date: Thu, 4 Jun 2020 05:21:47 -0500
  From: "Sender name" &lt;test@mysite.com&gt;
  Return-Path: &lt;test@mysite.com&gt;
  Reply-To: &lt;test@mysite.com&gt;
  User-Agent: CodeIgniter
  X-Sender: test@mysite.com
  X-Mailer: CodeIgniter
  X-Priority: 3 (Normal)
  Message-ID: &lt;5ed8cb3ba9e500.94682473@mysite.com&gt;
  Mime-Version: 1.0
  Content-Type: multipart/alternative; boundary="B_ALT_5ed8cb3ba9e702.65790334"
  =?UTF-8?Q?Test=20message?=
  This is a multi-part message in MIME format.
  Your email application may not support this format.
  
  --B_ALT_5ed8cb3ba9e702.65790334
  Content-Type: text/plain; charset=UTF-8
  Content-Transfer-Encoding: 8bit
  
  Hello
  
  
  --B_ALT_5ed8cb3ba9e702.65790334
  Content-Type: text/html; charset=UTF-8
  Content-Transfer-Encoding: quoted-printable
  
  Hello
  
  --B_ALT_5ed8cb3ba9e702.65790334--
  </code></pre>
  
  <p>And giving an error in error log:</p>
  
  <p><code>Email: sendWithMail throwed Use of undefined constant INTL_IDNA_VARIANT_UTS46 - assumed 'INTL_IDNA_VARIANT_UTS46' (this will throw an Error in a future version of PHP)</code></p>
  
  <p>I want to mention that,</p>
  
  <ol>
  <li>intl extension is enabled in server.</li>
  <li>I'm using cPanel.</li>
  <li>It was working fine on Codeigniter 3.</li>
  <li>The mail function is working with the row method in my server like this:</li>
  </ol>
  
  <pre><code>$to = 'receiver@gmail.com';
  $subject = 'Test message';
  $message = 'Hello';
  $headers = 'From: test@mysite.com' . "\r\n" .
          'Reply-To: test@mysite.com' . "\r\n" .
          'X-Mailer: PHP/' . phpversion();
  mail($to, $subject, $message, $headers);
  </code></pre>
  
  <p>Please help.</p>
  
  <p>Thanks in advance.</p>