[SOLVED] sendMail syntax error

I am new at OpenHAB and tried to use the Mail Action but always get an error.
Example:
sendMail("xxx@t-online.de", “test”, “test”)
Error Message
-bash: syntax error near unexpected token `“xxx@t-online.de”,’
Any hint how to solve this problem?

Have you configured your mail.cfg file?

sure:

######################## Mail Action configuration ####################################

The SMTP server hostname

hostname=securesmtp.t-online.de

the SMTP port to use (optional, defaults to 25 (resp. 587 for TLS))

port=587

the username and password if the SMTP server requires authentication

username=xxxxx@t-online.de

password=xxxxxxxx

The email address to use for sending mails

from=xxxxx@t-online.de

set to “true”, if TLS should be used for the connection

(optional, defaults to false)

tls=true

set to “true”, if SSL negotiation should occur on connection

do not use both tls=true and ssl=true

(optional, defaults to false)

ssl=false

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)

popbeforesmtp=false

If all the above is correct try adding a space in the message between the , and " like:

sendMail("xxx@t-online.de", “test”, “test”)

It’s a syntax error and everything else looks good.

hmmm - there is a space between the , and the " in my sendMail statement.
your sendMail is the same like mine.

Please, whenever posting code snippets, configurations or logs, put them in code fences. There is a big difference between

sendMail("xxx@t-online.de", “test”, “test”)

and

sendMail("xxx@t-online.de", "test", "test")

and there is no chance to find these errors - or even to eliminate these typos from the list of suspect.

1 Like

sorry I am a greenhorn – now with code fences:

sendMail("xxx@t-online.de", "test", "test")

Udo is hinting that you need to pay attention to your quote marks, things that look alike may not work alike

sendMail("xxx@t-online.de", "test", "test")

Note the different highlighting colours using code fencing