Gửi mail tiếng Việt utf8

Cái này nhớ mang máng là post lâu rồi mà tìm không thấy, take note lại vậy.
<?php
    if (isset($_SERVER['REMOTE_ADDR'])) exit(0);
    if ($argc != 3) {
        print 'Usage: ' . $argv[0] . ' <mail nguoi nhan> <noi dung>' . "\nExample: " . $argv[0] . ' "huyphungvan@gmail.com" "Phùng Văn Huy is now online"';
        exit(1);
    }
    $to = $argv[1];
    $msg = $argv[2];
    $sentSuccess = sendEmail($to, $msg);
    if ($sentSuccess) echo "Sent email to $to";
    else echo "Sent email to $to failed";
    
    
    function sendEmail($to, $message = '', $subject = 'Thư gửi Huy', $header = '') {
        # Thêm header này để thư gửi thuần Việt :-j
        $utf8Header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n";
        return mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', $message, $utf8Header . $header);
    }