Нужно простое решение. Как мониторить почту, и в зависимости от сообщения, выполнять какие то действия?

По сути, мне нужно все новые сообщения с почты, обрабатывать в php, проверять текст на наличие слов, и т.д, но решений на php я рабочих не нашел, везде какие то косяки. Может есть другие решения, позволяющие это сделать? В конечном итоге то что мне нужно. это обрабатывать данные писем в php
  • Вопрос задан
  • 167 просмотров
Пригласить эксперта
Ответы на вопрос 2
@DanKud
Для мониторинга входящей почты через IMAP можно использовать ddeboer/imap. Там же есть встроенный поиск по телу сообщения. Либо можете просто принимать почту и самостоятельно искать нужное вхождение в тексте письма с помощью function.preg_match
Ответ написан
Комментировать
@AlexanderKomarchouk
программист PHP, разработка на AVR ATmega
В наше время, когда каналы интернета были не такими широкими, мы иногда использовали сервисы типа FTPmail и ряд других, где можно было команды/запросы подавать по email.
Обратите внимание на ftpmail скрипт:

https://linux.die.net/man/1/ftpmail
ftpmail(1) - Linux man page
Name

ftpmail - FIFO-based Perl script for sending email based on proftpd TransferLog
Synopsis

ftpmail [ --help ] [ --fifo fifo-path ] [ --from email-address ] [ --log xferlog-file ] [ --recipient email-address ] [ --subject email-subject ] [ --smtp-server server-address ] [ --attach-file ] [ --auth smtp-auth-info-file ] [ --ignore-users regex-pattern ] [ --watch-users regex-pattern ]
Description

ftpmail is a Perl script designed to read ProFTPD's TransferLog log entries, watching for uploads, and to send an automatic email notification when uploads occur. To use ftpmail , you configure your proftpd daemon to write its TransferLog to a FIFO; the ftpmail program is a FIFO reading program which then processes those log messages.

Скачать на github
https://github.com/proftpd/proftpd/blob/master/contrib/ftpmail
#!/usr/bin/env perl
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2017 TJ Saunders <tj@castaglia.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
# ---------------------------------------------------------------------------

use strict;

use File::Basename qw(basename);
use Getopt::Long;
use Mail::Sendmail;
use MIME::Base64 qw(encode_base64);
use Time::HiRes qw(usleep);

my $program = basename($0);

my $opts = {};
GetOptions($opts, 'attach-file', 'fifo=s', 'from=s', 'help', 'ignore-users=s',
  'log=s', 'recipient=s@', 'upload-recipient=s@', 'download-recipient=s@',
  'sleep=s', 'smtp-server=s', 'subject=s', 'watch-users=s', 'auth=s');
...

Думаю вы сами скачаете скрипт, разберетесь, перепишете, и будете не общаться с FTP сервером посредством email, а делать то что нужно по условию вашей задачи.
Еще ссылочку ftpmail: Automated Email Notifications of Uploads
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы