[SOLVED] Postfix: How to get ZoneMinder to populate RCPT?

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Ger_Marsh
Posts: 5
Joined: Fri Oct 27, 2023 8:15 am

[SOLVED] Postfix: How to get ZoneMinder to populate RCPT?

Post by Ger_Marsh »

Hello,

Firstly, I am a new user of ZoneMinder but very impressed with its capabilities! Well done to all the contributors.

Secondly, I have installed the latest version on a Ubuntu laptop whose primary purpose is running Home Assistant to monitor a ground source heat pump, power usage etc. So far ZoneMinder is not having a significant effect on the machine's resources but I have not set up analysis - mainly as I do not know what it means!

My main problem is attempting to get events emailed. We are behind a CGNat so difficult to access the local network from the internet so emailing any event would be very useful. As ZoneMinder does not have the capability to use SMTP itself, I installed Postfix as suggested in a few places.

I became a bit confused as there is a clash between the fields in Options - Email and the filter form so I assume the filter form is actually used.

Here is an extract of the mail log...

Code: Select all

Oct 26 20:52:17 Ubuntu-Laptop postfix/smtp[413329]: A5EE51A088D8: to=<mailtest>, relay=smtp.stackmail.com[185.151.28.68]:465, delay=0.53, delays=0.04/0/0.39/0.09, dsn=5.0.0, status=bounced (host smtp.stackmail.com[185.151.28.68] said: 550 Cannot send a message as . Please send as mailserver@<redacted>.com. (in reply to RCPT TO command))
It is the same error I had when attempting a simple test using sendmail - which I think is a postfix implementation of sendmail!

Is there any control over the SMTP fields, such as RCPT?

Any help would be gratefully received.

By the way, even my wife is impressed! I shall attempt to probe the battery cameras she accesses by some app or other and try to obtain a rtsp URL or the like. Damn cloud cameras get on my wick!!

Bye for now,

Gerald.
Last edited by Ger_Marsh on Mon Oct 30, 2023 11:29 am, edited 1 time in total.
User avatar
iconnor
Posts: 3391
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: Postfix: How to get ZoneMinder to populate RCPT?

Post by iconnor »

This is all done in your postfix config...
I suspect you need to tell it what it's hostname is. In main.cf there should be a myhostname= line.
Ger_Marsh
Posts: 5
Joined: Fri Oct 27, 2023 8:15 am

Re: Postfix: How to get ZoneMinder to populate RCPT?

Post by Ger_Marsh »

Thanks very much for the prompt response!

I have set up myhostname as the name of the laptop.

I have worked around it from the command line using:

Code: Select all

sendmail -f <authenticated_email_login> <destination_email>
From: Fred
To: Bert
Subject: Test
Test
.
If I can frig the webforms to accept the "-f" parameter, it will work I think.
Ger_Marsh
Posts: 5
Joined: Fri Oct 27, 2023 8:15 am

Re: Postfix: How to get ZoneMinder to populate RCPT?

Post by Ger_Marsh »

I have eventually realised that the error means that there is no Return-Path. I cannot see how to implement it as it is not even partially formed from, for example, the hostname of the Linux laptop.

I tried to frig the interactive example by inserting Return-Path: ... into the input stream but that was ignored.
mikb
Posts: 705
Joined: Mon Mar 25, 2013 12:34 pm

Re: Postfix: How to get ZoneMinder to populate RCPT?

Post by mikb »

Having recently tried to set up outgoing (to internet) email on an Ubuntu 22.x laptop (and had it rejected by my ISP ...) I know the feeling.

You're right, there is no true sendmail -- it is a compatibility layer for postfix, the REAL MTA installed.

So :-

Code: Select all

echo "Postfix send only server" | mail -s "Postfix Testing" someone@somewhere.com
Did not work. Return-path: was invalid. No amount of fiddling with my already correct postfix config fixed this.

Code: Select all

echo "Postfix send only server" | mail -s "Postfix Testing" -r "validuser@mydomain.com" someone@somewhere.com
worked. This set the Return-path to something valid and my ISP were happy with it and forwarded it on.

And yet using

Code: Select all

echo "Postfix send only server" | sendmail someone@somewhere.com
just worked.

The problem was down to the MUA (mail, vs sendmail-really-its-postfix) not correctly doing the right thing.

I suspect you may need to pass your MUA some arguments (as above) to get it to work.
Ger_Marsh
Posts: 5
Joined: Fri Oct 27, 2023 8:15 am

[SOLVED] Re: Postfix: How to get ZoneMinder to populate RCPT?

Post by Ger_Marsh »

I eventually got the damn thing to work so here is a summary...

I set up a new email address with password with my ISP (20i - but others are available!).

I have called the actual domain name "gersdomain" in the following and the new email address is mailserver@gersdomain.com; "ispserver" is the domain name of the 20i mailserver.

Firstly, a section of the postfix configuration file - I am not sure how important some are...

Code: Select all

mydestination = $myhostname, localhost.localdomain, localhost
relayhost = smtp.ispserver.com:465
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
always_add_missing_headers = yes
Secondly, Options - Email. (I do not know why the MESSAGE_ADDRESS is in here when it has to be populated in the Filter.)

Code: Select all

MESSAGE_ADDRESS - usual email address
NEW_MAIL_MODULES - Selected
EMAIL_HOST - localhost
FROM_EMAIL - mailserver@gersdomain.com
Thirdly, the filters - I have included my template for the email subject and body...

Code: Select all

Email details of all matches - selected
Email to: usual email address
Email subject: ZoneMinder Event Detected on Monitor %MN% at %ET% (Cause: %EC%)
Email Body...
ZM alarm event - %EL% secs - was trapped by %FN% filter. 
There were %EFA% alarm frames in a total of %EF% frames.
Video attached.
%EV%
Today %MN% has had a total of %MET% events
Scores:
  Total :%EST%
  Average: %ESA%
  Maximum %ESM%
Monitor stream is here: %MPS%
Zoneminder console is here: %ZP%
I think that ZoneMinder's ability to fine tune alarms is excellent, even though I do not understand most of it!
Post Reply