diff --git a/src/web/server/mail/send_gmail.php b/src/web/server/mail/send_gmail.php index 4a44cce..bd923a3 100644 --- a/src/web/server/mail/send_gmail.php +++ b/src/web/server/mail/send_gmail.php @@ -11,12 +11,18 @@ require './../PHPMailer/src/SMTP.php'; // Load Composer's autoloader // require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'; -$sender_email = 'support@jinaju.com'; -$sender_name = '초코마에'; +function send_gmail($maestro_email, $maestro_name, $subject, $body) { + global $new_line; // = "\r\n"; + global $html_br_tag; // = "
"; -function send_gmail($email, $name, $subject, $body) { - global $sender_email; - global $sender_name; + // global $from; // = "support+chocomae@jinaju.com"; + // global $bcc; // = "support+chocomae.automail@jinaju.com"; + + // mail sender info + global $sender_name; // = "초코마에"; + global $sender_email; // = $from; + global $sender_address; // = $from; + global $sender_bcc; // = $bcc; $mail = new PHPMailer(true); @@ -26,7 +32,7 @@ function send_gmail($email, $name, $subject, $body) { $mail->isSMTP(); // Send using SMTP $mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication - $mail->Username = 'support@jinaju.com'; // SMTP username + $mail->Username = 'chocomae@jinaju.com'; // SMTP username $mail->Password = '52napark!'; // SMTP password $mail->CharSet = 'utf-8'; $mail->Encoding = "base64"; @@ -37,9 +43,9 @@ function send_gmail($email, $name, $subject, $body) { //Recipients $mail->SetFrom($sender_email, $sender_name); - $mail->addAddress($email, $name); // Add a recipient - $mail->addReplyTo($sender_email, $sender_name); - $mail->addCC($sender_email); + $mail->addAddress($maestro_email, $maestro_name); // Add a recipient + $mail->addReplyTo($sender_address, $sender_name); + $mail->addBCC($sender_bcc); // Content $mail->isHTML(true); // Set email format to HTML diff --git a/src/web/server/mail/send_mail.php b/src/web/server/mail/send_mail.php index 779168a..8b57a58 100644 --- a/src/web/server/mail/send_mail.php +++ b/src/web/server/mail/send_mail.php @@ -1,6 +1,11 @@ SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output + $mail->isSMTP(); // Send using SMTP + $mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through + $mail->SMTPAuth = true; // Enable SMTP authentication + $mail->Username = 'support@jinaju.com'; // SMTP username + $mail->Password = '52napark!'; // SMTP password + $mail->CharSet = 'utf-8'; + $mail->Encoding = "base64"; + $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption + // $mail->SMTPSecure = 'ssl'; + $mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above + + + //Recipients + $mail->SetFrom('support@jinaju.com', '초코마에'); + $mail->addAddress($address); // Add a recipient + // foreach ($addresses as $address) { + // $mail->addAddress($address); + // } + $mail->addReplyTo('support@jinaju.com', 'Information'); + $mail->addCC('support@jinaju.com'); + + // Content + $mail->isHTML(true); // Set email format to HTML + $mail->Subject = $subject; + $mail->Body = $body; + + $mail->send(); + echo 'Message has been sent'; + return true; + } catch (Exception $e) { + //echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; + return false; + } +} diff --git a/src/web/server/mail/test_gmail.php b/src/web/server/mail/test_gmail.php new file mode 100644 index 0000000..c184b0d --- /dev/null +++ b/src/web/server/mail/test_gmail.php @@ -0,0 +1,40 @@ +