주문완료 메일 3개추가

주문완료 메일 3개추가

QA

주문완료 메일 3개추가

본문

안녕하세요 질문즘드리겠습니다.

 

상품주문완료시 관리자에게만 주문완료 메일이오는데

 

 

ordermail1.inc.php 페이지내에서

 

 

test1@.com

test2@.com

test3@.com

 

총3개의 메일을 추가하고싶은데 방법이 있는지 궁금합니다.

 

https://sir.kr/qa/291193?&vpage=1#c_291283

 

 

해당 부분도 다해봤습니다.

 

 

lib/mailer.lib.php 

     if(is_array($to)) {
  foreach($to as $v) $mail->addAddress($v);
} else {
  $mail->addAddress($to);
}

 

추가 

 

ordermail1.inc.php  페이지 맨상단 

$to = 'test2@메일.co.kr, test1@메일.co.kr';

 

 

이렇게 추가를 해도 메일이 안옵니다 ㅠㅠ

이 질문에 댓글 쓰기 :

답변 1

orderform.update.php 안에 mailer 함수를 사용하시면 주문 완료 시 메일을 받아볼 수 있을 것 같습니다.

주문 완료 후 DB를 업데이트 하는 파일쪽에
mailer 함수를 보내고싶은 메일 갯수 만큼 추가하시면 될 것 같습니다.

ex) mailer("보내는 사람 이름", "보내는 사람 메일 주소", "[[여기에 받을 메일 주소]]", "메일 제목", "메일 내용")

<?php
if (!defined('_GNUBOARD_')) exit;

include_once(G5_PHPMAILER_PATH.'/PHPMailerAutoload.php');

// 메일 보내기 (파일 여러개 첨부 가능)
// type : text=0, html=1, text+html=2
function mailer($fname, $fmail, $to, $subject, $content, $type=0, $file="", $cc="", $bcc="")
{
    global $config;
    global $g5;

    // 메일발송 사용을 하지 않는다면
    if (!$config['cf_email_use']) return;

    if ($type != 1)
        $content = nl2br($content);

    $result = run_replace('mailer', $fname, $fmail, $to, $subject, $content, $type, $file, $cc, $bcc);
   
    if( is_array($result) && isset($result['return']) ){
        return $result['return'];
    }

    $mail_send_result = false;

    try {
        $mail = new PHPMailer(); // defaults to using php "mail()"
        if (defined('G5_SMTP') && G5_SMTP) {
            $mail->IsSMTP(); // telling the class to use SMTP
            $mail->Host = G5_SMTP; // SMTP server
            if(defined('G5_SMTP_PORT') && G5_SMTP_PORT)
                $mail->Port = G5_SMTP_PORT;
        }
        $mail->CharSet = 'UTF-8';
        $mail->From = $fmail;
        $mail->FromName = $fname;
        $mail->Subject = $subject;
        $mail->AltBody = ""; // optional, comment out and test
        $mail->msgHTML($content);
        if(is_array($to)) {
foreach($to as $v) $mail->addAddress($v);
} else {
$mail->addAddress($to);
}
        if ($cc)
            $mail->addCC($cc);
        if ($bcc)
            $mail->addBCC($bcc);
        //print_r2($file); exit;
        if ($file != "") {
            foreach ($file as $f) {
                $mail->addAttachment($f['path'], $f['name']);
            }
        }

        $mail = run_replace('mail_options', $mail, $fname, $fmail, $to, $subject, $content, $type, $file, $cc, $bcc);

        $mail_send_result = $mail->send();

    } catch (Exception $e) {
    }

    run_event('mail_send_result', $mail_send_result, $mail, $to, $cc, $bcc);

    return $mail_send_result;
}

// 파일을 첨부함
function attach_file($filename, $tmp_name)
{
    // 서버에 업로드 되는 파일은 확장자를 주지 않는다. (보안 취약점)
    $dest_file = G5_DATA_PATH.'/tmp/'.str_replace('/', '_', $tmp_name);
    move_uploaded_file($tmp_name, $dest_file);
    $tmpfile = array("name" => $filename, "path" => $dest_file);
    return $tmpfile;
}

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

회원로그인

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