Code Monkey home page Code Monkey logo

auto-reply-sakura's Issues

feat: 自動返信の重複送信を防止して欲しい

「代表メアド」→(転送)→「担当メアド A」といった設定で、各々のメアドで自動返信の機能を有効にすると、2通の自動返信メールが相手に送られてしまう。(代表メアドと担当メアドAからの自動返信)

このパターンに限っては、「代表メアド」の自動返信を無効にすれば解決できる。(担当メアド A のみが反応するため)

しかし、「代表メアド」→(転送)→「担当メアド A」「担当メアド B」といった複数の転送先がある場合に問題が発生する。

「代表メアド」のみ自動返信を有効にすることで自動返信の重複は回避できるが、今度は各担当者に直接送られてきたメールは自動返信されなくなってしまう。

feat: 定型文のファイルの所在も Conf ファイルで設定できるように

Before

  • ./template/ ディレクトリ内に設置

After

  • ./config/config.json にパスとファイルの記載を必須とし、そのテキスト・ファイルをテンプレートとして使用する。

Reason

「自動返信メールの内容を更新する」際の疎結合を高めるため。

例えば、独自 CMS/Wordpress といった「外部アプリなどから定型文を出力する」「FTP などによるアプロード」といった場合に、当アプリのディレクトリ内に保存を必須としてしまうと、それら外部要因と密結合してしまう。

つまり、「ディレクトリ構成が変わった」「テンプレート名が変わった」といった当アプリの仕様変更に対し、外部のアプリおよびユーザーにも仕様変更が必要になる。

Conf ファイルの指示により該当テンプレートを当アプリから参照するようにすることで、外部アプリやユーザー操作といった外部要因は、当アプリの仕様変更を気にする必要がなくなるので、より疎結合に近付く。

feat: 自動返信開始の時間指定ができるようにして欲しい

例えば「日曜日の夜18時から火曜日夜11:59まで」という条件に対応できるようにして欲しい。

火曜日の 11:59 は config.jsonTuesday を指定すれば問題ないので、日曜の 18:00 からトリガーできるようにして欲しい。

TL; DR(2020/06/15 現在の決定事項)

  • 従来スタイルから、開始および終了時間が設定できる記述スタイルに変更。
  • コメントの「提案2」を採用
{
    "weekday_to_reply": [
        {
            "weekday": "Sunday",
            "begin": "8:00",
            "end": "18:00"
        },
        {
            "weekday": "Monday"
        }
    ]
}
  • Weekday 要素: 必須
  • Begin 要素:オプション(< End)
  • End 要素: オプション(> Begin)

feat: 自動転送設定を自動で行うスクリプト

~/MailBox/<ユーザー>/.mailfilter は、ユーザー側の GUI(Web の UI)操作が行われると上書きされるので、対象ユーザーの .mailfilter に追記するスクリプトが欲しい。

% cd ~/suto-reply-sakura
% cat ./conf/user_auto_reply.json
{
   "user1",
   "user2",
   "user3"
}

% ./auto-reply.php set user1 user2 user3
Adding auto-reply settings to:
  user1 ... done
  user2 ... done
  user3 ... done
All done

% ./auto-reply.php unset user1 user2
Removing auto-reply settings from:
  user1 ... done
  user2 ... done
All done

".gitignore" the "composer.lock" file

composer.lock ファイルは composer.lock.debug とリネームして提供しておいて .gitignore で除外した方がいいと思います。

% cd ~/auto-reply-sakura
% composer update
...
% git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	composer.lock

nothing added to commit but untracked files present (use "git add" to track)

Disable phpunit/php-invoker (which is suggested and not required)

現象と再現方法

サーバーに composer をインストール&リポジトリを clone 後、依存パッケージをインストールすると the requested PHP extension pcntl is missing from your system エラーが出る。サーバーに pcntl エクステンションがインストールされていないためだがレンタルサーバーなので php.ini も触れない。

% composer install --no-dev
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/php-invoker 1.1.4 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
    - phpunit/php-invoker 1.1.3 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
    - phpunit/php-invoker 1.1.2 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
    - phpunit/php-invoker 1.1.1 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system.
    - Installation request for phpunit/php-invoker ^1.1 -> satisfiable by phpunit/php-invoker[1.1.1, 1.1.2, 1.1.3, 1.1.4].

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/php/5.6/etc/php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.

対策案

composer.jsonsymfony/consolephpunit/php-invokersuggest パッケージなので必須ではないため phpunit/php-invoker を削除。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.