Set up emails and easy email delivery

Hello, I wanted to raise a situation that I find very usual.

One of the problems I am encountering with tryton is the difficulty in setting up email accounts and being able to send from the application.

These difficulties are as follows:

1st: Difficulty for the client to enter the user, pwd, smtp server, port, of his email account (since many times they do not want to provide the information).

2nd: Be able to make promotions or mailings easily. The marketing module is a good idea but I think it is difficult to manage for a user.

3rd: In order to send emails from an Invoice, Sales … can only be performed by the action of a button such as accounting, process, … and not always have to be this way, since the client The best you need to send a text in the same mail.

The solutions or proposals are:

1st: Create a configuration screen where the client puts the data of his email account (user: pwd: smtp, …)

2nd: For us the marketing module should be easy to select the emails create a content and schedule / send.

3rd: On the print button, apart from the reports, you could show an action that is sent by email and that a form appears with the client’s email account and a description field where you can put what you want.

I hope I don’t bother with these ideas.

Thank you

So basically, you request to change the client into a mail user agent. I do not think it gonna happen because developing a MUA is a project as big (and maybe bigger) than Tryton.

It is not the user email account that Tryton needs but a dedicated email account for him to send email as the ERP.

Please make comments if you have some on before it will be included.
For me, it is very close to an usual MUA (but simplified). But of course new feature could be added like the possibility to upload images etc.

I guess we could display a confirmation dialog box in mailto command before calling the “mailto”. It will display the parameters: to, cc, subject and body.
But normally, the email client should already have this confirmation window?

For the web client, the email report option is not yet implemented but it should be possible using a mailto URI.

With the Tryton client you can use the “Email report” button to create a report, open your default email-client and fill the different fields. The report is attached with the email.

I think it could be possible to add those parameters to the user preferences. eventually username and password are needed. The rest is like server etc are general parameters and configured in the config file.

For what purpose? It is better that those parameters stay in the MUA and that the MUA send the email as usually it will store a copy in the mailbox.

I completely agree with you. It’s more about Tryton itself instead of the client. Because you are able to send emails from Tryton using smtpdatamanager.
Looking at my own situation and there I need a username and password to be able to send an email. You can use the defaults from the configuration file like the from and the smtp server location. But maybe sometimes you want to use the email address configured for the user in Tryton. For example you can do so with account_dunning_email, but in my case I need also an password to send the email. The username is the same as the email address. Also you want to use different email addresses for the different parts (marketing, invoice, dunning etc). I know maybe not the best example.

So in short. If you want to send email from Tryton automatically like account_dunning_email you use the defaults from the config file. But now you want to use the email address from the user logged in, so replies on that email comes into the right mailbox. In some cases a password is needed to send an email. Username is mostly configured as email address.

Well you do not need to setup this in Tryton itself. There are many options:

  • Use a different from header than the envelop.
  • Set a Reply-To header.
  • Configure the SMTP server to allow “tryton” user to send with different from envelop.
  • Configure the SMTP server to forward to the proper email server using the login/password of the from address.

I would recommend OpenSMTPD as mail server for such configuration because the configuration is very simple and clear.

On a second though, I think we could get rid of the “mailto” and have a dedicated dialog box for sending email via the Tryton server. As long as we use the On-Behalf-Of (and Repl-To) as explained in

So for me, the dialog would be:

  • To: filled with the report to value by default and with auto-completion using the contact mechanism. It is a comma separated list of addresses (maybe formatted with the party name).
  • Cc and Bcc: optional but behave like To
  • Subject: filled with report default
  • Message: the body from report by default with the user signature append after '-- '. The widget will use the richtext as it is HTML compatible.
  • Template: a list is existing template if selected fill the message content using the value of the record. Available only if a single record is selected.
  • Options as checkbox: “Send me a copy” (add the user as Bcc), “Request read receipt”, etc.
  • List of attachments: with the report by default. It can be edited by adding, removing and change the name.

When send is clicked, the client request the server to send it on behave of the user. The server send it directly in order to generate an error message.


In the same thread (9 years old, last post in 2018) they advice not to use the on-behalf-of because of getting trapped by spam filters. Or even completely banned by mail providers because of phishing attacks. It will work within the company, but outside it is questioned. Also I’ve only seen it within companies where a secretary is sending an email on-behalf-of a manager, mostly an meeting request.

If it is possible, add a From: in the dialog as well. The user can select it’s own email address or the default configured in the config file. Tryton will use the From: email address and if not the same as the users email address Tryton adds the Reply-To: to the email header.

It’s the responsibility of the admin user to setup the mail correctly.

I made some tests by sending such emails from my address to a (as they manage a very large portion of the email and they are defacto the standard others follow).
The On-Behalf-Of is indeed to use the From and Sender header. In the From, we put the “user address” and in Sender the “Tryton address”.
In such case, Gmail shows correctly that the email is from the “user address” but was send via “Tryton address” domain. The email is not put in the Spam. This is if the “user address” domain does not have DMARC setup.
Now if I do the same with a “user address” domain setup with DMARC which does not allow the “Tryton address” domain to send them. Then those email goes to the Spam folder (because the DMARC policy was quarantine. This is because the “From” is part of the DKIM headers. The same applies to wrong SPF configuration of course.

It works as expected but people need to know how to configure email servers to have a correct behavior.
So I think the default behavior should be to use “Tryton address” as From and add Reply-To. But we must have a configuration flag that allow to activate the “User address” as From with “Tryton address” as Sender and no Reply-To for the setup which are correctly configured.

You very often see this kind of behavior. The email is send from a and then there is a Reply-To: in the header or there is a reply email address (mailto) in the message body where a user can click on to reply on the email.

To make things more complex :slight_smile: Mostly the Reply-To: is an email alias. So when a company sends an invoice by email, the From: will be, the Reply-To: will be e.g. So multiple users gets your reply in their mailboxes. Maybe in Tryton this email addresses can be added on groups? So users who are in that group can fill the Reply-To: also with that email address.

This is not part of this topic. Here we are talking about user sending a report to someone which may lead to a conversation.
Invoice delivery is a different topic which is already managed by the notification_email module.

It was an example, replace invoice by report. IMO this is about manually sending any kind of report (sale, purchase, invoice, marketing, dunning, …). The notification_email is automatically sending reports.

Well I guess extra headers would be configurable like “Cc”, “Bcc” etc. And so “Reply-To” could also be added.
I think as it is for experienced users, it would be hidden behind a expandable option (like the CSV options).

I think we may not need the dialog box if configuration is complemented.

Couldn’t we manage all this in party’s contacts ? A “To” for invoice and a “To” for sale etc…

Would be good if it can be specific : “Your new invoice N XXXX”

If we use a template, it can include contact instructions like a signature.

If we use a single template, we may use “IF” clause in it so the content of the message follows the same rules than the document.

I would prefer this to be defined at template level, rather than by the user.

I would prefer not to have this capability

I do not think we can avoid the dialog box. The goal is to let the user customize the default values for example to add a comment or to attach a new document.
Otherwise it is the notification_email module that manage to define sending automatically emails.

We will present a default value per report but user will be free to send to any one.

That your own choice. This will be defined on the report and can be customized.

For me, there is no need to repeat the signature appending on all the templates. This can be done automatically and correctly (I mean using correct signature standard).

I would like to avoid templates with conditional clause because it will make them no more editable using the UI (Genshi clauses must be encoding on raw text).
Also this makes them harder to ensure correctness as each possible branches should be tested etc.
So for me, we should keep it simple using simple Python format syntax.
The IF clauses could be managed by creating multiple format and we could imagine to extend later the format to define condition to be used per record.

This is clearly a user choice to receive a copy or not.

So probably I need more a flexibility degree on notification_email module rather than a true email module.

I created Issue 9449: Send client email via server - Tryton issue tracker which is still work in progress (missing completion and sao version).

1 Like