폼메일 send로 넘어가요

폼메일 send로 넘어가요

QA

폼메일 send로 넘어가요

본문

문의하기 버튼을 누르면 send로 넘어가고 아무것도 안뜹니다..
이전에 되던 일자로 복원했는데도 그렇습니다..
도와주세요ㅠㅠ

mail_send 코드는 잘 있는데요..


<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require __DIR__ . '/lib/PHPMailer/src/PHPMailer.php';
require __DIR__ . '/lib/PHPMailer/src/Exception.php';
require __DIR__ . '/lib/PHPMailer/src/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
include_once('./_common.php');
if (isset($_POST['email'])) {
    $email_to = "*** 개인정보보호를 위한 이메일주소 노출방지 ***"; // 수신메일
    $email_subject = "[나무 속 자연공작소] {$_POST['first_name']} 님의 문의사항. {$_POST['mainlTitle']}";
    $email_subject = '=?UTF-8?B?' . base64_encode($email_subject) . '?=';
    if (!isset($_POST['first_name']) ||
        !isset($_POST['phone']) ||
        !isset($_POST['email']) ||
        !isset($_POST['mainlTitle']) ||
        !isset($_POST['comments']) ||
        !isset($_POST['agree'])) {
        die('Sorry.\nThere is a problem with the form you submitted.\nPlease check the form again.');
    }
    $first_name = $_POST['first_name']; // required
    $phone = $_POST['phone']; // not required
    $email = $_POST['email']; // required
    $comments = $_POST['comments']; // required
    $mainlTitle = $_POST['mainlTitle']; // required
    $group = isset($_POST['group']) ? implode(', ', $_POST['group']) : ''; // 다중체크
    $agree = $_POST['agree']; // required
    function clean_string($string) {
        $bad = array("content-type", "bcc:", "to:", "cc:", "href");
        return str_replace($bad, "", $string);
    }
    $email_message = "성명 : " . clean_string($first_name) . "<br><br>";
    $email_message .= "연락처 : " . clean_string($phone) . "<br><br>";
    $email_message .= "E-mail : " . clean_string($email) . "<br><br>";
    $email_message .= "제목 : " . clean_string($mainlTitle) . "<br><br>";
    $email_message .= "분야 : " . clean_string($group) . "<br><br>"; // 다중체크
    $email_message .= "문의 내용 : " . clean_string($comments) . "<br><br>";
    $email_message .= "개인정보처리방침 : " . clean_string($agree) . "<br><br>";
    // PHPMailer setup
    $mail = new PHPMailer(true);
    try {
        // Server settings
        $mail->isSMTP();
        $mail->Host = 'smtp.gmail.com';
        $mail->SMTPAuth = true;
        $mail->Username = '*** 개인정보보호를 위한 이메일주소 노출방지 ***'; // Your Gmail address
        $mail->Password = 'orqscwfrxfrxoenf'; // Your Gmail password or App Password
        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
        $mail->Port = 587;
        // Recipients
        $mail->setFrom('*** 개인정보보호를 위한 이메일주소 노출방지 ***', '한국세라프');
        $mail->addAddress($email_to);
        // Content
        $mail->isHTML(true);
        $mail->Subject = $email_subject;
        $mail->Body = $email_message;
        $mail->send();
        // Use header for redirect after PHP execution
        header("Location: /home/sub04_04.php");
        exit();
    } catch (Exception $e) {
        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
    }
}
?>
 

이 질문에 댓글 쓰기 :

답변 1

아무것도 안뜨는건 오류가 있어서 일겁니다

소스 디버깅해서 오류가 어디서 나는지 체크를 해보셔야 할듯 합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 124,859 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT