-
Notifications
You must be signed in to change notification settings - Fork 1
Home
sendmail.py is a sendmail-like application for testing purposes with pipelining messages processing for Linux developed in Python 3.
sendmail.py developed for usage in the Debian based Linux distributions.
You can use it as "fake sendmail" for PHP web sites.
Successfullty tested in the following OS:
Application provides two scripts:
- sendmail.py - reads email messages from standard input and then process it according to your settings using one of available processors:
- FilesystemProcessor - saves messages to files in the specified directory.
- NotifyProcessor - displays desktop notifications when message sent. Does not works if sendmail.py used in the Apache2 environment; in this case watch.py need to be used.
- SmtpProcessor - sends messages using SMTP server.
- MandrillProcessor - sends messages using Mandrill API (you need to create Mandrill API key).
- watch.py - watches filesystems and displays desktop notifications when new message file created. Active Watcher displays icon in the system tray area.
- python3-notify2
- python3-pyinotify
Install dependencies in Ubuntu:
sudo apt-get install \
python3-notify2 \
python3-pyinotify
Possible installation methods:
- Clone git repository.
- Download Zip Archive.
git clone https://github.com/chupikov/sendmail.py.git /home/user/bin/sendmail.py
cp /home/user/bin/sendmail.py/config-sample.json /home/user/bin/sendmail.py/config.json
WARNING! When you use sendmail.py from Apache NotifyProcessor will not works - in this case you have to use Watcher application.
Create separate file (for example /home/user/bin/sendmail.py/config-php-apache2.json
).
[
{
"name": "FileSystem: /var/mail/sendmail/new",
"class": "FilesystemProcessor",
"enabled": true,
"directory": "/var/mail/sendmail/new",
"num_file": "/var/mail/sendmail/num",
"extension": ".eml",
"number": 1,
"name_length": 6
},
{
"name": "SMTP Server",
"class": "SmtpProcessor",
"enabled": true,
"username": "yourmail@yourdomain.com",
"password": "YOUR_PASSWORD",
"host": "SMTP_SERVER_ADDRESS",
"port": 25,
"to_address": "yourmail@yourdomain.com",
"from_address": "yourmail@yourdomain.com",
"starttls": true
}
]
Create directory defined in the directory
section of the configuration file and allow write to all:
sudo mkdir /var/mail/sendmail
sudo mkdir /var/mail/sendmail/new
sudo chmod -R 777 /var/mail/sendmail
In the Ubuntu PHP configuration file for Apache located in /etc/php5/apache2/php.ini
.
Open file /etc/php5/apache2/php.ini
and edit sendmail_path
option:
sendmail_path = /home/user/bin/sendmail.py/sendmail.py -c /home/user/bin/sendmail.py/php-apache2.json
Restart Apache:
sudo service apache2 restart
After configuration you can use Watcher application in purposes of receive desktop notification messages about emails sent from Apache.
/home/user/bin/sendmail.py/watch.py -c /home/user/bin/sendmail.py/php-apache2.json