How to to send email with trigger

Hi,

I am getting the follow traceback after try to send an email from a custom trigger, using 5.6 and AWS SES

Jan 18 16:42:10 localhost uwsgi[611]: 28501 140337916364544 [2021-01-18 22:42:10,932] ERROR trytond.sendmail fail to send email
Jan 18 16:42:10 localhost uwsgi[611]: Traceback (most recent call last):
Jan 18 16:42:10 localhost uwsgi[611]:   File "/opt/capy/lib/python3.7/site-packages/trytond/sendmail.py", line 39, in sendmail
Jan 18 16:42:10 localhost uwsgi[611]:     senderrs = server.sendmail(from_addr, to_addrs, msg.as_string())
Jan 18 16:42:10 localhost uwsgi[611]:   File "/usr/lib/python3.7/smtplib.py", line 888, in sendmail
Jan 18 16:42:10 localhost uwsgi[611]:     raise SMTPDataError(code, resp)
Jan 18 16:42:10 localhost uwsgi[611]: smtplib.SMTPDataError: (554, b"Transaction failed: Missing final '@domain'")

The tryton config line to email is

uri = smtp+tls://tryton@example.net:1234@smtp.example.net:587

I tried the follow command
trytond-admin --test-email <email>@gmail.com -c tr.conf -d capybaradb | grep -v INFO

And received
Success!
** Your email settings work correctly.**

Any help will be welcome!

I think it’s because the first @. You need to encode that symbol in uri, something like:
uri = smtp+tls://tryton%40example.net:1234@smtp.example.net:587

I have made the change but without success.

Did you set any form value on the trigger? If yes which value are you using? Did you set a domain?

As the test email is using the default from it may be the reason that email is working there but not on the trigger

1 Like

I was working on Sao, for some reason I need to use Tryton an after it the trigger works fine.

I have the same config and values in form, but if I create it from Sao does not work.

What is “it”? It is the trigger? What are the different in the table between both clients?

Yes, if I create the trigger on Sao it does not work, but if I create it from Tryton it works fine. A quit strange but it works fine now.

Please provide the difference between the two creation!

Sao form


Tryton form

The only difference I noticed is that Sao in condicion field uses symbol ’ and tryton " but not sure it is related to the behavior. Even if I use ’ in sao it writes " after save.

Please could you show the difference in the database.

Hi,
After copy the trigger they are almost the same, the only difference are a spaces between them.

I’m working with 5.8 version
image

BTW, the trigger is working fine now.

So there is no difference in behavior between both clients. I think your previous statement is not correct. It is not linked to the client creating the rule.

1 Like

I think the same.

The trigger was created from a notification email, same information on both clients. Maybe is a different think but don’t know what, I will create both from start and try it again.

Making all the process again in tryton client works for resolve this.

I really think the solution for that traceback was related to @ encoding , nothing to do with the client and maybe you didn’t restart trytond at that time, so configuration was not refreshed.

1 Like