Email still not working

Support and queries relating to all previous versions of ZoneMinder
Locked
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Email still not working

Post by c0mputerking »

Hello all i am having a very hard time to get email notification working right now i am getting this error.

Can't send email: Failed to connect to mail server: Invalid argument
at /usr/bin/zmfilter.pl line 956

these are the relevent lines from /usr/bin/zmfilter.pl

954 ### Send the Message
955 MIME::Lite->send( "smtp", ZM_EMAIL_HOST, Timeout=>60 );
956 $mail->send();
}

I have localhost set for ZM_EMAIL_HOST and the ZM_NEW_MAIL_MODULES enabled not being very good at perl do not know what line 956 does really.

PLEASE HELP i will donate Smile

I also have post several other times relating to this error namely here http://www.zoneminder.com/forums/viewtopic.php?t=12408
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

I have localhost set for ZM_EMAIL_HOST
So you are running a mail server on the zm box? Sendmail, postfix, qmail or other? If so, can you send mail from the commandline?
Failed to connect to mail server: Invalid argument
This tells you where to look for the problem.
If you want to use a mail server on the zm box, debug it first. Once it is working then zoneminder can use it.

If you have no reason to run a mail server on your zm box other than for zoneminder it is usually simpler to use smtp for email alerts. ie set ZM_EMAIL_HOST to something like "mail.myisp.com". Some ISP mail servers are fussy about the ZM_FROM_EMAIL address. If your ISP requires authentication for smtp service then you will need futher assistance so post back how it goes.
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Yes there is a working email server installed

Post by c0mputerking »

Thank you for the reply i really am desperate to get this sorted. I am using postfix to send email on this machine and it is working perfectly (from what I can tell) Below is me sending a mail and the output of my corresponding /var/log/messages Also the email appears correctly in my inbox at king@computerking

However using zoneminder i get stuff appearing in the logs like this but still nothing ever seems to hit postfix

Also if turn the ZM_NEW_MAIL_MODULES feature off i get the same message in the logs this even includes the Email notifacation sent message but i do not get the errors about line 965 when running /usr/bin/zmfilter.pl. However there is still nothing being fed to postfix

==> /var/log/zoneminder/zmfilter.log <==
11/25/08 15:07:06.633015 zmfilter[6442].INF [Creating notification email]
11/25/08 15:07:06.638146 zmfilter[6442].INF [Sending notification email 'CKS: Alarm - Domeblack-267 (255 - 255 56)']
11/25/08 15:07:06.641974 zmfilter[6442].INF [Attaching '//var/www/zoneminder/htdocs/events/2/267/011-capture.jpg]
11/25/08 15:07:06.669179 zmfilter[6442].INF [Notification email sent]

Here is me testing postfix everything seems ok

c0mputerking@hellen ~ $ mail king@computerking.ca
Subject: test
aksdlfaj
kjds;lfj
ksdj;lf

Nov 25 14:48:04 hellen postfix/smtp[5969]: 585F46129: to=<king>, relay=mx1.computerking.ca[66.244.200.225]:325, delay=0.48, delays=0.22/0.07/0.1 /0.09, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as EFAF4B003A)
Nov 25 14:48:04 hellen postfix/cleanup[5966]: B6DE2613C: message-id=<20081125214>
Nov 25 14:48:04 hellen postfix/local[5968]: B6DE2613C: to=<c0mputerking>, relay=local, delay=0.08, delays=0.04/0/0/0.04, dsn=2.0.0, status=se nt (delivered to maildir)
Nov 25 14:48:04 hellen postfix/qmgr[5228]: B6DE2613C: removed

Please help i promise i will make a donation or paid support or what ever is needed to get this feature working
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

Hmm, OK let's have some more info.
What values do you have for ZM_FROM_EMAIL and ZM_EMAIL_ADDRESS?
What do you have in /etc/hosts that refers to interfaces on the zm box?
What distro are you using?

The best clue so far is the error message "Failed to connect to mail server: Invalid argument"
Either there is a problem with the configuration of postfix, or zoneminder is trying to pass values postfix doesn't like.

Meanwhile I'll try to reproduce this error here.
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

Thanks again for your reply once we get this solved i promise i will donate. Anyways i here are the values you asked for

ZM_FROM_ADDRESS zm@computerking.ca
ZM_EMAIL_ADDRESS king@computerking.ca

I am running Gentoo fairly up to date

This is the entire contents of my /etc/hosts file ps the localhosts is odd should that not be localhost without the s? I have commented out the line with the s and added a new one without the s see below but things still do not work

#127.0.0.1 hellen.computerking.ca hellen localhosts
127.0.0.1 hellen.computerking.ca hellen localhost

ps if you look to the end of this post you can see which prerequisites i had problems figuring out the Gentoo equivalents for the most part i got everything installed. Also postfix is sending regular mail ok just not zoneminder stuff

http://www.zoneminder.com/forums/viewtopic.php?t=12408
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

This is the entire contents of my /etc/hosts file ps the localhosts is odd should that not be localhost without the s? I have commented out the line with the s and added a new one without the s see below but things still do not work

#127.0.0.1 hellen.computerking.ca hellen localhosts
127.0.0.1 hellen.computerking.ca hellen localhost
This would definitely create a problem with any part of the system trying to resolve "localhost"
Did you do a reboot on your system after editting /etc/hosts?
Does this make any change in the error message with ZM_NEW_MAIL_MODULES enabled?
User avatar
rdmelin
Posts: 863
Joined: Wed Oct 29, 2003 2:23 pm
Location: Ellensburg, WA USA

Post by rdmelin »

ps if you look to the end of this post you can see which prerequisites i had problems figuring out the Gentoo equivalents for the most part i got everything installed.
If you don't already have them I think the packages you need are dev-perl/MailTools dev-perl/TimeDate and dev-perl/DBD-mysql
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

Yes i did a reboot after changing the hostname but still nothing hitting postfix zoneminder always seems try but nothing shows in the /var/log/messages for postfix.

Also i added the packages suggested dev-perl/MailTools dev-perl/TimeDate and dev-perl/DBD-mysql

Things still are not working ....... arrrrrrg so i added some more packages /dev-perl/Mail-Sendmail
/dev-perl/Mail-Sender

/dev/perl/Mime-Lite
/dev-perl/Mime-tools
/dev-perl/Mime-Types

However some progress i now get a different error (same line of code) see below. hmmmmmm

/usr/bin/zmfilter.pl
Can't send email: Failed to connect to mail server: Bad file descriptor
at /usr/bin/zmfilter.pl line 956
Can't send email: Failed to connect to mail server: Operation now in progress
at /usr/bin/zmfilter.pl line 956
Can't send email: Failed to connect to mail server: Operation now in progress
at /usr/bin/zmfilter.pl line 956
c0mputerking
Posts: 190
Joined: Tue Sep 16, 2008 5:22 am

Post by c0mputerking »

WOOOOPEEEEEE!!!! It is working I forgot i was messing with the hostname in zoneminder very late last night i have set it back to localhost and things are working now

THANK YOU THANK YOU THANK YOU

Donation on its way
cubber
Posts: 9
Joined: Fri Jul 18, 2008 4:47 pm

Post by cubber »

I am trying to get email alerts working under gentoo in 1.24.2. The event I created seems to work but the emails never get sent and there are no errors in /var/log/messages.

This is what I get in messages when an even has been generated and the filter runs:

Code: Select all

 zmfilter[6452]: INF [Archiving event 188]
 zmfilter[6452]: INF [Creating notification email]
 zmfilter[6452]: INF [Sending notification email 'ZoneMinder: Alarm - Driveway-188 (255 - 255 228)']
The server sends emails fine via the command line and using php web forms that are hosted on it. It is Gentoo Linux running ssmtp for mail. I have tried numerous things to fix this and none have worked. I pulled in all the packages that are listed above in the previous posts.

Any help would be greatly appreciated.
drew10
Posts: 3
Joined: Mon Jul 27, 2009 6:06 am

Post by drew10 »

Thank you for the reply i really am desperate to get this sorted. I am using postfix to send email on this machine and it is working perfectly (from what I can tell) Below is me sending a mail and the output of my corresponding /var/log/messages Also the email appears correctly in my inbox at king@computerking
mrd
Posts: 269
Joined: Wed Apr 26, 2006 12:39 am
Location: Boston USA

Post by mrd »

I'm seeing the same problem as Cubber with no obvious errors.
MRD
mrd
Posts: 269
Joined: Wed Apr 26, 2006 12:39 am
Location: Boston USA

Fixed it..

Post by mrd »

I've fixed this for Arch Linux (The ZMLArch_1.24.2_2) version...

It was a missing perl lib (even though there were no errors in zmfilter.log showing this).

Execute as root:
pacman -S perl-email-date-format

I'm still seeing a few problems though. It takes 5 minutes for the email to actually send even though, zmfilter.log claims that it sends immediately after zmfilter.pl detects the matching event. I can execute an excerpt of the zmfilter.pl script that sends the same mail message and it is received immediately.

Also, zmfilter.pl ignores additional email addresses that are separated by commas or spaces. I can execute an excerpt of the zmfilter.pl script that handles sending to multiple addresses fine with either comma or space between so there must be some ZM logic that strips the additional addresses off.
MRD
Locked