티스토리 뷰

xe에서 게시판 관리자 들어가면 글 쓰면 메일이 가는게 있다. 그런데 이런저런 이유로 잘 안가는 경우도 있다.


그래서 인터넷 찾아보면 여러가지 방법도 나와 있긴 한다.


일단 현재 xe에서 메일 보내는 방식은 아래와 같다.


board.controller.php 파일에 메일 보내는 부분


// send an email to admin user

if($output->toBool() && $this->module_info->admin_mail)

{

$oModuleModel = getModel('module');

$member_config = $oModuleModel->getModuleConfig('member');

$oMail = new Mail();

$oMail->setTitle($obj->title);

$oMail->setContent( sprintf("From : <a href=\"%s\">%s</a><br/>\r\n%s", getFullUrl('','document_srl',$obj->document_srl), getFullUrl('','document_srl',$obj->document_srl), $obj->content));

$oMail->setSender($obj->user_name ? $obj->user_name : 'anonymous', $obj->email_address ? $obj->email_address : $member_config->webmaster_email);


$target_mail = explode(',',$this->module_info->admin_mail);

for($i=0;$i<count($target_mail);$i++)

{

$email_address = trim($target_mail[$i]);

if(!$email_address) continue;

$oMail->setReceiptor($email_address, $email_address);

$oMail->send();

}

}


여기는 xe/classes/mail/Mail.class.php 파일


<?php

/* Copyright (C) NAVER <http://www.navercorp.com> */


require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php";


/**

 * Mailing class for XpressEngine

 *

 * @author NAVER (developers@xpressengine.com)

 */

class Mail extends PHPMailer

{


/**

* Sender name

* @var string

*/

var $sender_name = '';


/**

* Sender email address

* @var string

*/

var $sender_email = '';

.

.

.

}

/* End of file Mail.class.php */

/* Location: ./classes/mail/Mail.class.php */


Mail.class.php 파일은 phpmailer.php 파일을 임포트 하는것을 알 수 있다.


phpmailer.php 파일은 xe/libs/phpmailer/phpmailer.php 에 있다.




if (version_compare(PHP_VERSION, '5.0.0', '<') ) exit("Sorry, this version of PHPMailer will only run on PHP version 5 or greater!\n");


class PHPMailer {


  /////////////////////////////////////////////////

  // PROPERTIES, PUBLIC

  /////////////////////////////////////////////////


  /**

   * Email priority (1 = High, 3 = Normal, 5 = low).

   * @var int

   */

  public $Priority          = 3;


  /**

   * Sets the CharSet of the message.

   * @var string

   */

  public $CharSet           = 'utf-8';


  /**

   * Sets the Content-type of the message.

   * @var string

   */

  public $ContentType       = 'text/plain';


  /**

   * Sets the Encoding of the message. Options for this are

   *  "8bit", "7bit", "binary", "base64", and "quoted-printable".

   * @var string

   */

  public $Encoding          = '8bit';


.

.

.

이 3개의 파일을 관찰하고 응용해보면 xe 에서 사용자 정의 메일을 보낼 수 있으리라..

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함