I am looking at using dma as the replacement for the removed sendEmail from IPFire. According to the dma Wiki I should be able to send a test message from the command line with:
sendmail.dma -s “DMA test mail” me@my.domain
This is a test mail
enter Control+D on a new line to send it.
This results in an error: invalid argument: `-s - which should set the subject line in the email.
I can send test messages from the mail.cgi page OK and send test messages without the subject line (-s) from the command line but are then blocked by spamassassin due to the missing Subject Line by the server.
Has anyone successfully sent emails with a ‘Subject Line’ from the command line with dma ? If this isn’t possible then perhaps we should retain sendEmail which works without difficulty.
Rather hacky, I guess, and you will probably have to take care of Message-ID and other fields on your own. However, there has to be a better way for doing this. Let me skim though our CGI file, and report back…
Thank you for your suggestion Peter, I have managed to send a test message with the Subject line sent locally.
It seems that dma unlike its predecessor sendEmail hasn’t the provision for formatting the email so I had to create an email as as temporary file as your suggestion (/tmp/email.test) such as this:
From: root@ipfire-dev.my.domain
To: me@my.address
Subject: “Test with dma”
Date: Sat, 3 Jul 2021 15:25:03 +0000 (UTC)
test2 from dma on ipfie-dev
and send it with this:
cat /tmp/email.test | sendmail me@my.address
dma seems to happily generate a message ID but I’ll need a way of generating the Date: header dynamically since the date is copied from the file.
I currently use sendEmail to send my logs to dshield using a hacked IPCop addon - logsend. It may be easier for me to import a local version of sendEmail after it has been removed from the available addons in IPFire rather than further modify logsend to use dma.
You could, but I would advise against it. sendEmail has not been under active development for many many years and the website has been taken down, too.
This is outdated and unmaintained software which is why we removed it. It is dangerous to be used.
dma is maintained and comes with more features. It however requires are valid email as input.
I understand your advice but, as I have found, dma is not a direct replacement for sendEmail as it looks like it requires a front end to format the email before dma can send it.
Looking at the mail.cgi page it looks like IPFire uses perl modules as the front end to dma. I have to wonder what use that page is since all it seems to be capable of is sending test messages and not doing anything particularly useful, or perhaps I have missed something!
dma is an MTA (which is what you want here). It would really try to deliver that email, even if the SMTP server was unavailable.
sendEmail is more of a MUA. It tries to connect to the server, but if anything goes wrong you are not receiving an email ever.
That is why we went with dma. It would be great if would be easier to send rich emails from the console, but this is generally not in scope of any MTA (Postfix, exim, etc.) do not have this functionality either. But the Python standard library allows composing emails in very few lines and Perl has modules for that, too. It doesn’t take more than a couple of lines.
Currently only a few add-ons are using this functionality. We always wanted to extend this, but time is tight.
I am aware of the MUA / MTA differences, in my unusual case I have a mail server running sendmail and dovecot on a different computer which handles all my internal and external email so errors are handled by that computer, so an MUA works fine for me and dma is a bit of an overkill for my network.
I’ll look into writing a perl program. I see perl module MIME::Lite is available so maybe I can use that.
Incidently when my server was bouncing some of my erroneous attempts to use dma with the -s switch, dma was producing log file errors:
“ trying delivery
local delivery deferred: can not create /var/mail/root' error creating mbox root’
cannot execute /usr/lib/dma-mbox-create: No such file or directory”
After I manually created /var/log/root, dma was able to deliver the bounces to that file and the error messages stopped.
That maybe there is a bug with dma (probably permissions) which may need addressing sometime.
Hi Micael,
I’m fully with your tactics to move away from software, which hasn’t been progressed for a while.
Nevertheless, I tried to migrate sending file attachments to DMA. Unfortunately I could find any variable supporting this. Also using the file content as mail body didn’t worked out so far.
Any idea how to realise this functionality with the DMA?
I ended up using this shell script to send my firewall reports to dshield which you may find helpful. This has been running without any problem over the last year. The script formats the email and sends it via /usr/sbin/sendmail. Remember you need to set up a working mail server address in IPfire’s mail service tab. Using this I didn’t need to create the /var/mail/root directory.
Sorry to bring this back to life, but it seems to be the most appropriate place to ask this question.
My /var/log/mail contains hourly log entries as follows:
Nov 16 14:00:00 ipfire dma[10044b.9e7e8c0]: <root> trying delivery
Nov 16 14:00:00 ipfire dma[10044b.9e7e8c0]: cannot execute /usr/lib/dma-mbox-create: No such file or directory
Nov 16 14:00:00 ipfire dma[10044b.9e7e8c0]: error creating mbox `root'
Nov 16 14:00:00 ipfire dma[10044b.9e7e8c0]: local delivery deferred: can not create `/var/mail/root'
Nov 16 14:00:00 ipfire dma[10044b.9e7e8c0]: can not bounce a bounce message, discarding
Nov 16 15:00:00 ipfire dma[10044b.9e7e8c0]: <root> trying delivery
Nov 16 15:00:00 ipfire dma[10044b.9e7e8c0]: cannot execute /usr/lib/dma-mbox-create: No such file or directory
Nov 16 15:00:00 ipfire dma[10044b.9e7e8c0]: error creating mbox `root'
Nov 16 15:00:00 ipfire dma[10044b.9e7e8c0]: local delivery deferred: can not create `/var/mail/root'
Nov 16 15:00:00 ipfire dma[10044b.9e7e8c0]: can not bounce a bounce message, discarding
/var/mail/root exists and has the following properties:
# ls -l /var/mail/root
-rw-r--r-- 1 root mail 0 Oct 27 22:25 /var/mail/root
What should the file permissions and ownership be?
Also, there’s a reference to creating a file /var/log/root above. Is that a typo? Did @helix intend to say /var/mail/root?
The IPFire Mail Service configuration page — /cgi-bin/mail.cgi sends a test e-mail using MIME::Lite.
However
MIME::Lite is not recommended by its current maintainer. There are a number of alternatives, like Email::MIME or MIME::Entity and Email::Sender, which you should probably use instead. MIME::Lite continues to accrue weird bug reports, and it is not receiving a large amount of refactoring due to the availability of better alternatives. Please consider using something else.
I don’t have /var/log/root or /var/spool/root on either of my CU188 or CU198 installations. I am still using the shell script shown above without errors run as root and also a similar perl script again run as root.
Typical entries to /var/log/mail are:
Nov 17 16:01:00 griffith6 dma[1b0f]: new mail from user=root uid=8 envelope_from=
Nov 17 16:01:00 griffith6 dma[1b0f]: mail to= queued as 1b0f.ca3a80
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: trying delivery
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: using smarthost (x:25)
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: trying remote delivery to x [192.168.0.4] pref 0
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server greeting successfully completed
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server supports STARTTLS
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server supports LOGIN authentication
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: SSL initialization successful
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server greeting successfully completed
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server does not support STARTTLS
Nov 17 16:01:00 griffith6 dma[1b0f.ca3a80]: Server supports LOGIN authentication
Nov 17 16:01:03 griffith6 dma[1b0f.ca3a80]: delivery successful
So I would think the errors are coming from dma-mbox-create which isn’t present of either of my installations.
My perl email script can be found in the ‘sub mail’ section here: