<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[댓글 첨부파일및 사진파일 메일발송]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/33747</link>
		<description><![CDATA[<p>안녕하세요.</p>

<p>또 문의드립니다.</p>

<p>댓글을 메일로 잘 할용하고 있습니다.</p>

<p>얼마전에 코스모팜에 도움을 받아 신규작성게시물 파일을 첨부하면  신규알림메일에 첨부한 사진과 파일이 전송되는 기능을 잘 활용하고 있습니다.</p>

<p>문제는 댓글에 파일을 첨부하면 댓글발송 메일에 사진이나 파일이 첨부될수 있는지 문의 드립니다.</p>

<p>            $mail_content .= $comment-&gt;content;<br />
            $url = new KBUrl();<br />
            $mail = new KBMail();<br />
            $mail-&gt;to = $email;<br />
            $mail-&gt;title = "[댓글알림] {$content-&gt;title}";<br />
            $mail-&gt;content = $mail_content;<br />
            $mail-&gt;url = $url-&gt;getDocumentRedirect($content-&gt;uid);<br />
            $mail-&gt;url_name = __('Go to Homepage', 'kboard');<br />
            $r = $mail-&gt;send();</p>

<p> </p>

<p>댓글메일 발송 코드입니다.</p>

<p> </p>

<p>매번 감사합니다.</p>

<p> </p>

<p> </p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

현재의 구조로는 댓글 작성 시 첨부파일 및 사진 전송이 어려울 듯합니다.

KBoard 댓글...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/33751</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>현재의 구조로는 댓글 작성 시 첨부파일 및 사진 전송이 어려울 듯합니다.</p>

<p>KBoard 댓글 플러그인 쪽 코드를 수정해주셔야 할 듯합니다.</p>

<p> </p>

<p>직접 파일 수정이 가능하시다면,</p>

<p>FTP로 접속해서 /wp-content/plugins/kboard-comments/class/KBCommentController.class.php 파일에</p>

<p>아래의 코드를 찾아보세요.</p>

<pre>
<code class="language-php">wp_redirect(wp_get_referer() . "#kboard-comments-{$content_uid}");</code></pre>

<p>찾은 코드 <strong>위에</strong> 아래의 코드를 추가해보시겠어요?</p>

<pre>
<code class="language-php">do_action('kboard_after_comments_insert', $comment_uid, $content_uid, $board);</code></pre>

<p> </p>

<p>그 다음, 워드프레스 관리자 -&gt; 외모 -&gt; 테마 편집기 페이지에서 functions.php 파일 하단에</p>

<p>아래의 코드를 추가해보세요.</p>

<pre>
<code class="language-php">add_action('kboard_after_comments_insert', 'my_kboard_after_comments_insert', 10, 3);
function my_kboard_after_comments_insert($comment_uid, $content_uid, $board){
	if($board-&gt;id == '1'){
		$comment = new KBComment();
		$comment-&gt;initWithUID($comment_uid);
		
		$content = new KBContent();
		$content-&gt;initWithUID($content_uid);
		
		$mail_attachments = array();
		
		if(isset($comment-&gt;attach-&gt;image1)){
			array_push($mail_attachments, KBOARD_WORDPRESS_ROOT.$comment-&gt;attach-&gt;image1[0]);
		}
		if(isset($comment-&gt;attach-&gt;file1)){
			array_push($mail_attachments, KBOARD_WORDPRESS_ROOT.$comment-&gt;attach-&gt;file1[0]);
		}
		
		$email = '이메일주소';
		
		$mail_content = $comment-&gt;content;
		$url = new KBUrl();
		$mail = kboard_mail();
		$mail-&gt;to = $email;
		$mail-&gt;title = "[댓글알림] {$content-&gt;title}";
		$mail-&gt;content = $mail_content;
		$mail-&gt;url = $url-&gt;getDocumentRedirect($content-&gt;uid);
		$mail-&gt;url_name = __('Go to Homepage', 'kboard');
		$mail-&gt;attachments = $mail_attachments;
		$r = $mail-&gt;send();
	}
}</code></pre>

<p>위의 코드에서 $board-&gt;id == '1' 부분은 실제 게시판 id로 적용해주세요.</p>

<p>이메일주소 부분에는 알림 받을 이메일 주소로 적용해보세요.</p>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Wed, 05 Jun 2019 07:23:48 +0000</pubDate>
			<category>KBoard</category>
		</item>
			</channel>
</rss>