I have problem with mail function and PHPMailer package on my site.
at first i tried to send email with mail function:
mail('myemail@gmail.com', 'Test Mail - Raw', 'Test message.');
mail has been sent successfully but not received in my inbox or spam.
after a lot of search i add a header to mail function:
mail('myemail@gmail.com', 'Test Mail - Without Reply-To', 'Test message', "From: mahdyaslami <myemail@gmail.com>");
and finally i found my sent mail in spam with a yellow warning.
i want to user PHPMailer package because i want to attach file and i add this code.
protected function send($from, $to, $subject, $body, $altBody, $attachmentPath): bool
{
    // Instantiation and passing `true` enables exceptions
    $mail = new PHPMailer(true);
    $mail->SMTPDebug = SMTP::DEBUG_SERVER;
    $mail->SMTPSecure = 'ssl';
    $mail->isSMTP();
    $mail->isSendmail();
    $mail->setFrom($from);
    $mail->addReplyTo($from, $from);
    $mail->addAddress($to);
    $mail->isHTML(true);
    $mail->Subject = $subject;
    $mail->Body = $body;
    $mail->AltBody = $altBody;
    if ($attachmentPath) {
        $mail->addAttachment($attachmentPath);
    }
    $mail->send();
    return true;
}
but i have first problem, my mail has been sent successfully but i can not receive mail in my inbox or spam.
