Sending emails with dma

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.

Regards

Rob

Hi,

this information seems to be outdated. At least on dma's manpage -s does not appear (anymore).

Could you try passing the Subject header via the message body such as this:

$ sendmail random.person@example.com <EOF
From: "Me, Myself and I" <john.doe@example.com>
To: "Random Person" <random.person@example.com>
Subject: "Subject line goes here"
Date: Sat,  3 Jul 2021 06:30:03 +0000 (UTC)
[other headers]

[body content]

EOF

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…

Thanks, and best regards,
Peter Müller

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.

Thank you for your help

Rob

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.

2 Likes

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!

Rob

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.

3 Likes

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.

Thank you for your help

Rob

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?

Best regards & thanx for all your great work