サポート » プラグイン » Subscribe2:メール本文が途中で切れた

  • 記事を投稿すると同タイミングで、同内容をメールマガジンとして配信する為に、
    Subscribe2(現在インストールしているVerは5.6)を導入しています。

    既に14~5回の配信実績があり、これまでは特に問題なく配信されていましたが、
    前回配信時に、メールの本文が途中で切れてしまうという現象が発生しました。
    途中で切れてしまった配信メールの最後に[…]という文字列があるので、
    何らかの原因で記事が抜粋として扱われてしまったのではないかと推測しています。

    subscribe2.phpのコードを追ってみましたところ、
    563行目、581行目、3319行目にそれぞれarray_push($words, '[...]');の記述が見られます。
    前後のコードは以下の通りですが、phpについて詳しくない為、
    どのような条件で[…]を追加されたのかが判断できません。
    読めないなりに、何となく「抜粋がある場合、または本文に<!–more–>がある場合…」→push […]かな?とも思っているのですが。

    563行目前後

    $excerpt = $post->post_excerpt;
    		if ( '' == $excerpt ) {
    			// no excerpt, is there a <!--more--> ?
    			if ( false !== strpos($plaintext, '<!--more-->') ) {
    				list($excerpt, $more) = explode('<!--more-->', $plaintext, 2);
    				// strip leading and trailing whitespace
    				$excerpt = strip_tags($excerpt);
    				$excerpt = trim($excerpt);
    			} else {
    				// no <!--more-->, so grab the first 55 words
    				$excerpt = strip_tags($plaintext);
    				$words = explode(' ', $excerpt, $this->excerpt_length + 1);
    				if (count($words) > $this->excerpt_length) {
    					array_pop($words);
    					array_push($words, '[...]');
    					$excerpt = implode(' ', $words);
    				}
    			}
    		}

    581行目前後

    $html_excerpt = $post->post_excerpt;
    		if ( '' == $html_excerpt ) {
    			// no excerpt, is there a <!--more--> ?
    			if ( false !== strpos($content, '<!--more-->') ) {
    				list($html_excerpt, $more) = explode('<!--more-->', $content, 2);
    				// strip leading and trailing whitespace
    				$html_excerpt = balanceTags($html_excerpt);
    				$html_excerpt = trim($html_excerpt);
    			} else {
    				// no <!--more-->, so grab the first 55 words
    				$words = explode(' ', $content, $this->excerpt_length + 1);
    				if (count($words) > $this->excerpt_length) {
    					array_pop($words);
    					array_push($words, '[...]');
    					$html_excerpt = implode(' ', $words);
    					$html_excerpt = trim(balanceTags($html_excerpt));
    				}
    			}
    		}

    3319目前後

    $excerpt = $post->post_excerpt;
    			if ( '' == $excerpt ) {
    				 // no excerpt, is there a <!--more--> ?
    				if ( false !== strpos($post->post_content, '<!--more-->') ) {
    					list($excerpt, $more) = explode('<!--more-->', $post->post_content, 2);
    					$excerpt = strip_tags($excerpt);
    					if ( function_exists('strip_shortcodes') ) {
    						$excerpt = strip_shortcodes($excerpt);
    					}
    				} else {
    					$excerpt = strip_tags($post->post_content);
    					if ( function_exists('strip_shortcodes') ) {
    						$excerpt = strip_shortcodes($excerpt);
    					}
    					$words = explode(' ', $excerpt, $this->excerpt_length + 1);
    					if ( count($words) > $this->excerpt_length ) {
    						array_pop($words);
    						array_push($words, '[...]');
    						$excerpt = implode(' ', $words);
    					}
    				}
    				// strip leading and trailing whitespace
    				$excerpt = trim($excerpt);
    			}

    また、今回失敗した配信メールには、%という文字や
    機種依存の丸囲みの数字(①、②など/うっかり差換え忘れてしまいました;)を含んだ文を
    配信しているのですがそれが関係することはありますでしょうか?
    ちょうどその文字が入った前後で切れてしまったので。

    今後同様のことが発生しないようにしたいので、原稿作成上の注意でも結構ですので
    何かお分かりになる方がいらっしゃいましたら、アドバイスのほどよろしくお願い致します。

4件の返信を表示中 - 1 - 4件目 (全4件中)
  • 設定で全文なり抜粋なり細かく指定できますが、これでもダメということですか?

    トピック投稿者 hiduru

    (@hiduru)

    takuya様、ご回答有難うございます。

    設定とは、下記の部分でしょうか?

    設定>Subscribe2>自動登録>
    自動購読したユーザーへ送信するメール形式:
    HTML(全文) HTML(抜粋) プレーンテキスト(全文) プレーンテキスト(抜粋)

    確認したところ、どれにもチェックが入っていない状態でした。
    ひょっとしてプラグインのバージョンアップで最近追加された項目だったりするでしょうか?
    (だとしたら確認不足だった訳ですね…汗)
    プレーンテキスト(全文)にチェックを入れておきました。

    お手数をお掛けしますが、引き続き情報ご提供のほどよろしくお願い申し上げます。

    トピック投稿者 hiduru

    (@hiduru)

    この投稿の後、プレーンテキスト(全文)にチェックが入っているのを確認し、
    配信ユーザをバックアップを取った上で一旦データベースから削除して、
    今回問題が起きた記事と、以前配信して問題なかった記事の配信テストを行ってみました。

    結果、問題の無かった方の記事は全文配信されたのに対し、
    問題のあった記事は、配信されるメールが同じように途中で切れてしまいました。
    正直、何が原因か掴みきれずにおります。

    皆様にはお手数をお掛けしますが、何か原因に心当たりのある方がいらっしゃいましたら、
    引き続き情報提供のほどよろしくお願い致します。

    解決方法ではないのですが、すでにやっているとは思いますが応急処置を。
    私も同じことで悩んでいました。
    結局、抜粋を送信するのが仕様であるようなので、投稿画面の抜粋欄にも記事全文をコピーして問題解決しております。
    抜粋が何文字と決まっているようなので、その字数以内なら全文送信でき、それ以上になると抜粋文字数分の文が送信されているのだと思います。

4件の返信を表示中 - 1 - 4件目 (全4件中)
  • トピック「Subscribe2:メール本文が途中で切れた」には新たに返信することはできません。