As we do for contact mechanisms of phone type it would be useful to validate email mechanisms too.
We had some troubles when sending emails from Tryton because the user defined an incorrect email on the party contact mechanism. The main problem is that they send the message to this wrong email from Tryton but they do not get noticed that the email was incorrect because at least in our case we send the message from a noreply email which is receiving another email from google warning that the email couldn’t be sent but no ones are noticing about it.
On one hand I think that we should validate emails when creating/modifying contact mechanism but on the other hand maybe we also should check it again before sending the email because an email could be deprecated since it was created.
Maybe we can use some python library as flanker to validate emails.
Thoughts?
Your problem is not that the email is not a valid format but the email does not exist.
I doubt we want to send a validation email each time a contact mechanism is added. Indeed as you said you have been warned that the email does not exist but you just did not read it.
Now the improvement could be to be able to use a different MAIL FROM than the From so you can have a distinct bounce address.
Indeed notification_email, marketing_email etc. are all providing the possibility to have different from’s. The one in the configuration which is used for the envelope and the one set on the database record for the header.
What you’re saying is a good improvement, but I wasn’t very precise with my last message. The reality is that I have both problems and the one that worries me most is when no notification is sent to the email.
For example, some users set the value field of the contact mechanism to ‘John john@example.com’ and in this case the email does not receive any notification, but the mail is not sent either.
What I’m trying to say is that I found cases where users fill the contact mechanism with the address but also with some other string like the name of the contact (all in the value field) and when they send an email from Tryton to this address it is not sended in reality and neither no warning notification is recived.
Anyway if I do not get wrong this case would be solved by validateing email address on user input.
For exemple, Tryton allows you to define as recipient the address “John”.
In this case, through Tryton it seems that the email is sent well, but the reality is that it was not sent (without any notification).
Another case is that John is defined as a recipient and also a valid email as a secondary recipient. In that case, the email is sent but only to the secondary recipient (without any notification).
Instead, gmail does not allow you to send this email due to the format of the recipient’s address.
I hope this solves your doubts.