kboard 신규글 작성시 메일발송 에 첨부파일및 사진파일 전송

안녕하세요 

매번감사합니다.

신규글 작성시 메일을 잘 사용하고 있습니다.

공지사항을 사용하고 있는데.

 

사진파일이나 첨부파일을 사용하면 해당글이 텍스트는 메일로 전송이 되는데 첨부한 파일이나 사진은메일로 전송이 되지 않습니다.

같이 전송할수 있는 방법이 없나요?

매번 감사합니다.

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
  • 안녕하세요.

    KBoard 플러그인 최신글 이메일 알림에 첨부파일과 입력필드를 추가하시려면

    아래의 순서대로 진행해보세요.

     

    1. FTP로 접속해서 /wp-content/plugins/kboard/class/KBContent.class.php 파일에

    아래의 코드를 찾아서

    $url = new KBUrl();
    $mail = new KBMail();
    $mail->to = explode(',', $board->meta->latest_alerts);
    $mail->title = apply_filters('kboard_latest_alerts_subject', '['.__('KBoard new document', 'kboard').'] '.$board->board_name.' - '.$this->title, $this);
    $mail->content = apply_filters('kboard_latest_alerts_message', $this->content, $this);
    $mail->url = $url->getDocumentRedirect($this->uid);
    $mail->url_name = __('Go to Homepage', 'kboard');
    $mail->send();

    아래의 코드로 교체해보세요.

    $url = new KBUrl();
    $mail = new KBMail();
    $mail->content_uid = $this->uid;
    $mail->to = explode(',', $board->meta->latest_alerts);
    $mail->title = apply_filters('kboard_latest_alerts_subject', '['.__('KBoard new document', 'kboard').'] '.$board->board_name.' - '.$this->title, $this);
    $mail->content = apply_filters('kboard_latest_alerts_message', $this->getDocumentOptionsHTML() . $this->content, $this);
    $mail->url = $url->getDocumentRedirect($this->uid);
    $mail->url_name = __('Go to Homepage', 'kboard');
    $mail->send();

     

    2. /wp-content/plugins/kboard/class/KBMail.class.php 파일에

    아래의 코드를 찾아서

    var $headers;

    찾은 코드 위에 아래의 코드를 추가해보세요.

    var $content_uid;

     

    아래의 코드를 찾아서

    $result = wp_mail($this->to, $this->title, $message, $this->headers);

    아래의 코드로 교체해보세요.

    $attachments = apply_filters('kboard_latest_alerts_attachments', $this->getAttachments(), $this);
    $result = wp_mail($this->to, $this->title, $message, $this->headers, $attachments);

     

    아래의 코드를 찾아서

    public function message_template($args){
    
    	$subject = $args['subject'];
    	$message = wpautop($args['message']);
    	
    	ob_start();
    	include_once KBOARD_DIR_PATH . '/assets/email/template.php';
    	$args['message'] = ob_get_clean();
    	
    	return $args;
    }

    찾은 코드 밑에 아래의 코드를 추가해보세요.

    public function getAttachments(){
    	$content = new KBContent();
    	$content->initWithUID($this->content_uid);
    	$attachments = array();
    	
    	if($content->isAttached()){
    		foreach($content->getAttachmentList() as $key=>$attach){
    			$attachments[] = KBOARD_WORDPRESS_ROOT . $attach[0];
    		}
    	}
    	
    	return $attachments;
    }

     

    위에 적용된 코드는 아래의 링크에서도 확인하실 수 있습니다.

    https://github.com/cosmosfarm/KBoard-wordpress-plugin/blob/master/plugins/kboard/class/KBContent.class.php

    https://github.com/cosmosfarm/KBoard-wordpress-plugin/blob/master/plugins/kboard/class/KBMail.class.php

    고맙습니다.

  • 안녕하세요~^^

    아쉽게도 현재는 지원하지 않는 기능입니다.

    추후 연구 개발해서 업데이트하도록 하겠습니다.

    고맙습니다.

  • #커뮤니티 자동 추천글

    ora 의 스레드

    더보기

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요