SMTPDebug = 0; $mail->isSMTP(); $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->Username = 'atakandoganozban@gmail.com'; $mail->Password = 'odxv setp ofgk sutp'; $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; $mail->Port = 465; $mail->CharSet = 'UTF-8'; $mail->setFrom('atakandoganozban@gmail.com', 'Request Collector'); $mail->addAddress('ozbanatakan2@gmail.com', 'Request Recipient'); $mail->addReplyTo($email, $isim); // Konu başlığı $mail->Subject = "[atakanozban.com.tr] New Website Contact Request - " . $subject; // Mesaj içeriği $mail->isHTML(true); $mail->Body = nl2br("

This form was filled and sent by {$isim}.

E-Mail address: {$email}

Subject: {$subject}

Message:
{$content}

"); // Dosya ekleme if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] == 0) { $allowedTypes = ['image/jpeg', 'image/png', 'application/pdf']; $fileType = $_FILES['attachment']['type']; if (!in_array($fileType, $allowedTypes)) { echo "Only these file formats can just upload: pdf, jpg and png!"; exit; } $mail->addAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']); } $mail->send(); echo "Your message sent, thanks!"; } catch (Exception $e) { echo "Message can't send. Error: {$mail->ErrorInfo}"; } ?>