SMTP Relay server issues?

Jul 17, 2018
17
2
USA
I run my own SMTP relay server via docker and use it for BI alerts among others. Wanted to try the detection features on my Dahua cameras (several models), but I'm not able to successfully test the SMTP settings. All I get is failed.
Checked my firewall logs and the camera isn't even trying to reach my server on port 25. Note the camera is on an isolated VLAN.
Does anyone know if local SMPT servers are even supported. I suspect it doesn't like having an IP listed as the SMTP server.
 
Check if clients from CCTV VLAN can access local SMTP server - send emails, it is a problem of configuration for sure.
 
Tested with gmail and it works, though that is not my preferred choice.
What settings are you using for Gmail? I could never get it to work. Nowadays the email providers are wanting OAuth2, and I don't see that option in the Dahua NVR. I was using Outlook.com for the longest time, but they just changed their requirements, and now I cannot use it.

Mike
 
This is the reason for the outlook.com smtp issue. To resolve it for me I just created a gmail email address which I am using purely for smtp. Any snapshots just pop up on my normal outlook.com email with the sender shown as my gmail address. As mentioned earlier in the thread you use an 'app password' which is generated from your gmail account. Other than setting gmail up, that's it, once done you can forget about gmail, it doesn't need any maintenance and can be left alone trundling along in the background.

Screenshot 2024-10-05 061517.png
 
Just wondering if anyone got to the bottom of this? I'm currently experiencing the same issues with a local SMTP relay. The relay is configured to accept basic unauthenticated SMTP email on port25. The image below shows this working from the Camera's network in the putty session. Yet the camera which would seem to have the same settings doesn't work.

I've run tests from the same network as the cameras and can successfully send email via the relay from that network. I've even run Wireshark captures and that would seem to indicate that the camera doesn't even attempt to establish a session with the SMTP relay.

The only conclusion I can currently come to is that it's a firmware issue.

Cheers
Lindsay

SMTPRelayTest.png
 
Long-time lurker here -- I appreciate years of great info from this forum..

Yes, I believe I know what's happening and why, after doing several experiments and packet-captures:
  • The Email settings page is poorly-worded IMO, making it ripe for confusion about what some of the fields actually do.
  • The "Anonymity" checkbox (it's called "Anonymous" in the new WebUI) does NOT mean to bypass doing SMTP authentication! Anonymity really means to set the email's "From:" header field to "<>" (which will show as blank to the email recipient) instead of copying the value of the "Sender" into the email's "From:" line! Apparently this is all the Anonymity checkbox does. It is especially misleading that the default Username is "anonymity", which happens to match the name of the checkbox just above it, but the Anonymity checkbox is apparently not related at all to SMTP authenticationl! Argh!!
  • If any of the SMTP Server, Port, Username, Password, or Sender fields are blank, the "Test" button will fail immediately without initiating any network traffic to the SMTP server.
  • The SMTP Server must support the "AUTH LOGIN" SMTP command -- if the SMTP Server to which your camera is connecting wasn't compiled with proper AUTH support, the "Test" button will fail. For example, the default sendmail on BSD systems (e.g.: FreeBSD) is not compiled with SMTP AUTH support enabled (to avoid spammers continuously-pounding on the SMTP server in the hope they can find one weak password that lets them forward spam through it).
  • The Username and Password you enter must be valid/correct for your SMTP server.
  • The default "Password" field shows **************** but it appears that the default password field is actually blank (even though it shows asterisks); this leads to an immediate "Fail" until you manually-enter your own non-blank text into the Password field then click "Save".
  • The "Sender" field must be set to a proper / non-blank string (ie user@domain.com)
  • The "Mail Receiver" field (the email address of the recipient) is set by entering an address, then clicking "Save" before attempting a "Test".
  • In general, if you change any of the fields, recommend you click "Save" before clicking "Test".
  • If you are still getting a "Fail", recommend doing a packet capture -- if no packets are seen between your camera and the SMTP Server, then chances are one of the fields is blank or wrong (again the Password field can show asterisks even if the value is blank, so make certain you set a non-blank Password). If there is network traffic and you see "Fail", then it's probably a wrong password or the SMTP Server might be returning an error for some reason -- recommend looking at the SMTP Server's logs if you have access.
  • The newer WebUI also allows setting the "Encryption Type". I recommend using "None" to minimize encryption overhead.
Dahua should change the Email config page to tell the user what actually failed, would save a lot of head-banging! :banghead:

Hope this helps!
 
  • Like
Reactions: MyDaHua
Thanks marq, some really useful information there. Poor user interface design is a real pet peeve of mine!

Here I was thinking an unauthenticated SMTP relay was going to make my life easier. Looks like I'll have to look into getting auth going on my relay.

Cheers
Lindsay
 
Just checking back in to confirm that marq's advise assisted in resolving my issues. Thanks marq!

First think I did was populate the username and password fields with data. After this I could see the camera establishing a connection in the firewall logs
I then needed to reconfigure my local relay to accept auth and created an account
I was then able to reconfigure the camera with my newly created authentication details and can successfully get emails through.

Cheers
Lindsay