V
V
Vlad Galapad2018-05-20 18:17:48
linux
Vlad Galapad, 2018-05-20 18:17:48

We need a simple solution. How to monitor mail, and depending on the message, perform some actions?

In fact, I need to process all new messages from the mail in php, check the text for the presence of words, etc., but I didn’t find working solutions in php, there are some jambs everywhere. Maybe there are other solutions to do this? Ultimately what I need. is to handle email data in php

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DanKud, 2018-05-20
@DanKud

You can use ddeboer/imap to monitor incoming mail via IMAP . There is also a built-in search in the body of the message. Or you can just accept mail and independently search for the desired occurrence in the text of the letter using function.preg_match

A
Alexander Komarchuk, 2018-07-14
@AlexanderKomarchouk

In our time, when the Internet channels were not so wide, we sometimes used services such as FTPmail and a number of others, where it was possible to submit commands / requests by email.
Take a look at the ftpmail script :

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.

Download on github
https://github.com/proftpd/proftpd/blob/master/contrib/ftpmail
#!/usr/bin/env perl
# ---------------------------------------------------------------------------
# Copyright (C) 2008-2017 TJ Saunders <[email protected]>
#
# 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', '[email protected]', '[email protected]', '[email protected]',
  'sleep=s', 'smtp-server=s', 'subject=s', 'watch-users=s', 'auth=s');
...

I think you will download the script yourself, figure it out, rewrite it, and you will not communicate with the FTP server via email, but do what you need according to the condition of your task.
Another ftpmail link: Automated Email Notifications of Uploads

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question