Hello,
I’m trying to use the sendmail action.
But I can’t get it to work.
- I placed the “org.openhab.action.mail-1.8.3” action in the addons map of my openhab server.
- i set the settings in my config file:
######################## Mail Action configuration ####################################
#
# The SMTP server hostname, e.g. "smtp.gmail.com"
mail:hostname=smtp.telenet.be
# the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS))
mail:port=587
# the username and password if the SMTP server requires authentication
mail:username=XXX
mail:password=XXX
# The email address to use for sending mails
mail:from=XXX@telenet.be
# set to "true", if TLS should be used for the connection
# (optional, defaults to false)
mail:tls=true
# set to "true", if POP before SMTP (another authentication mechanism)
# should be enabled. Username and Password are taken from the above
# configuration (optional, default to false)
#mail:popbeforesmtp=
- I used a test rule:
when
System started
then
sendMail("tomymail@telenet.be", "This is the email subject", "This is the email body")
end
I don’t know or this line has to be in the rule file (with or without it, I get the same result):
import java.util.List
Problem is that I don’t receive any e-mail.
In the log I see a error that the mail could not be send with the following reason:
Caused by: javax.mail.SendFailedException: Send failure (javax.mail.MessagingException: Can't get local hostname. Please correctly configure JDK/DNS or set mail.smtp.localhost)
My “/etc/hostname” contains:
openhab
My “/etc/hosts” contains:
127.0.0.1 localhost
127.0.1.1 openhab.localdomain openhab
I have no idea what is wrong, how can i solve this?
Thanks!