12-16-2016 11:18 AM
Hello,
I have an ISR4331, running 15.5(3)S3. I am trying to configure it to send emails based some various triggers. I have it mostly working, however when it tries to send an email, I see in the debugs:
Dec 16 19:07:49.024: %HA_EM-6-LOG: EMAIL_TEST : DEBUG(smtp_lib) : fh_smtp_read {501 5.1.7 Invalid address
}
Dec 16 19:07:49.024: %HA_EM-6-LOG: EMAIL_TEST : DEBUG(smtp_lib) : buffer no reply code matched: 501 5.1.7 Invalid address
Dec 16 19:07:49.024: %HA_EM-3-FMPD_SMTP: Error occurred when sending mail to SMTP server: smtp.office365.com : error in reply from SMTP server
From what I have read, this means that the sender of the email is not recognized. I assume this is because I am trying to use an authenticated user on Office 365. Does anyone know what the proper format is for configuring authenticated users in EEM? I have tried several variations with no luck. Or is this only supported using TCL? Here is the relevant config:
event manager environment _email_to bob@domain.com
event manager environment _email_server smtp.office365.com
event manager environment _email_from noreply:password@domain.com
event manager applet EMAIL_TEST
event syslog pattern "LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback.*up"
action 2.0 mail server "$_email_server" to "$_email_to" from "$_email_from" subject "email subject here" body "email body here" port 587 secure tls
action 3.0 syslog priority notifications msg "email sent"
12-19-2016 07:07 AM
Authenticated email where the username has an '@' is not supported using applets. You will need to use Tcl to be able to do this. But that doesn't appear to be what you're doing here.
I'm not sure what the MS-returned error means exactly. The wrapped error means our code was not expecting it. My guess is that while you appear to be trying to do authentication using the "from" address, that is wrong. Authentication needs to be done with the mailserver in the form user:pass@mailserver. But again, if your username has an '@' in it, that will not work in an applet. And TLS will not work in Tcl.
12-19-2016 07:30 AM
Thanks Joe,
I just tried using the following, to authenticate with the mail server:
event manager environment _email_to bob@domain.com
event manager environment _email_from noreply@domain.com
event manager environment _email_server noreply:password@smtp.office365.com
When I do this, I get a different error:
Dec 19 15:20:24.548: %HA_EM-6-LOG: EMAIL_TEST : DEBUG(smtp_lib) : fh_smtp_read {535 5.7.3 Authentication unsuccessful
}
Dec 19 15:20:24.548: %HA_EM-6-LOG: EMAIL_TEST : DEBUG(smtp_lib) : buffer no reply code matched: 535 5.7.3 Authentication unsuccessful
Dec 19 15:20:24.548: %HA_EM-6-LOG: EMAIL_TEST : DEBUG(smtp_lib) : fh_send_mail: password rejected
Dec 19 15:20:24.548: %HA_EM-3-FMPD_SMTP: Error occurred when sending mail to SMTP server: noreply:mailpass12345!@smtp.office365.com : error in reply from SMTP server
Dec 19 15:20:24.548: %HA_EM-3-FMPD_ERROR: Error executing applet EMAIL_TEST statement 2.0
However if I understand you correctly, there is no way to get this working if:
1) my username "noreply@domain.com" contains the "@" symbol
AND
2) SMTP server requires TLS
Is this correct?
If I change the username in the _email_server variable to include @domain, it failed to connect to the SMTP server at all, as expected.
12-19-2016 07:40 AM
Yeah, sounds like you're in a no-win situation. You would need to be able to create a gateway that either does unauthenticated or unencrypted SMTP then relays to MS. I've seen someone post a service using gmail, but not using office365.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide