Configure Outgoing Mail Servers on Debugging - odoo

When configuring OMS you can specify, whether it's a debugging server or not. I marked it as one, but I couldn't find any information about that mark. I can check it manually and do not send emails when I'm on debugging server...
mail_values = template.with_context(context).generate_email(self.id)
mail = self.env['mail.mail'].create(mail_values)
IrMailServer = self.env['ir.mail_server'].search([], order='sequence desc')[0]
if not IrMailServer.smtp_debug:
mail.send()
But is there any better possibility to do so? Or maybe it's already implemented somewhere, and I couldn't find it?

This flag is used for showing more debugging information in the Odoo logfile. Your Odoo server has to be configured with log level "debug" to show these information.
With this conditions you will see the SMT protocol (SMTP) messages in your Odoo log, which makes it much easier to find out about problems sending emails from Odoo.
It's not a test mode! You will really send emails with this settings.

Related

Triggering tasks from email in a node server

After having done various research I cannot find the best way to achieve this:
I have a Node Express server, providing services to various users
I would like any user to be able to send an email to user-id#mydomain.com
Upon reception, I would like to trigger a specific task in the server, to process the email body.
Option 1
I was first hoping to find some kind of SMTP node package that I could simply embed in the server, and configure it with the various email addresses to be accepted, and with a callback function to trigger the task whenever an email arrives. Does this exist?
Option 2
Another option would be to install a SMTP server (ideally in a Docker container, and in any case on Linux), to handle the storage of each user mailbox. My Node server would then periodically check each user mailbox via POP3 or IMAP, and trigger the task whenever an email is found. But this seems a bit overkill to me:
I don't need to store the emails once the task is performed
This would be less responsive than having a callback like in the first option, and would require a periodic check of all users, whereas in practice, such emails will arrive very sporadically.
In this approach, what would you recommend as a dockerized SMTP server, and as a POP3/IMAP node package to retrieve and process emails?
Option 3?
Would there be any other approach?
Any recommendation welcome!!
Many thanks!
It looks like the Node smtp-server package can do the job. Combined with mailparser I can retrieve a Javascript object with the email structure fully parsed.

How does one configure Kogito to fire BPMN Notifications?

I have an extremely basic BPMN2 diagram that is being served by a local Kogito instance. I can move through the various tasks without issue.
A single user task has a notification configured to send an email. This notification configuration was created with the VS Code Tools provided by Kogito. Below is the XML generated for the notification in the bpmn2 file.
<bpmn2:dataInputAssociation>
<bpmn2:targetRef>_26A2A9B8-5A6F-4D0B-A388-66795F520516_NotStartedNotifyInputX</bpmn2:targetRef>
<bpmn2:assignment>
<bpmn2:from xsi:type="bpmn2:tFormalExpression"><![CDATA[[from:|tousers:|togroups:|toemails:person#place.com|replyTo:|subject:Hello world|body:I wish I wish this email would fire.]#[PT1M]]]></bpmn2:from>
<bpmn2:to xsi:type="bpmn2:tFormalExpression"><![CDATA[_26A2A9B8-5A6F-4D0B-A388-66795F520516_NotStartedNotifyInputX]]></bpmn2:to>
</bpmn2:assignment>
</bpmn2:dataInputAssociation>
I've dug through the Kogito documentation and examples and could not find a way to configure notifications. Is this something that is supported and just needs to be configured? At the very least is there an event that I can write a listener for to send the email myself?
its old question though, have you tried service task to execute notification of your choice?
it might not available at the time of question, but now we can run this based on our flow
now user task has notification too
for editor based notification we have API now for different channels, see link
https://blog.kie.org/2021/02/kogito-notifications-api.html

Spiking a message in OpenFire

I wanted to write a plugin in OpenFire to inspect incoming messages between users and possibly stop this message from ongoing to the target recipient.
I can write a plugin that implement PacketInterceptor, but is there an api that supports blocking this packet from being sent or possibly modifying the body.
The rational for this is possibly offensive or illegal content. The times we live in :(
I found a packet filter created to do exactly this.
It can be found at https://www.igniterealtime.org/projects/openfire/plugins/packetfilter/readme.html

Error notification on mule flows

I am relatively new to mule and Im wondering if there is a built in error notification if there an error on a mule flow or if this can be set up in the mmc to trigger an alert if something is wrong with the flow. Please advise.
Thanks and Have a good day!
You can do it in several ways.
The MMC can do log analysis send an email if matches a certain pattern.
You can simply had an exception handling in the flow like a Catch Exception and do the send of a mail there, I wrote a blog post having has sample this case
You can use mule notification system to create a java class that will manage this notification, maybe using log4j SMTP appender to easily send notification mails.
This are my opinion about the 3 methods
First method relies on the mmc being up, mmc creates load on your mule server anyway by making calls and in some production environnement it may be disabled depending on the internal policy of the company. Furthermore if for some reasons goes down you will not receive any notification so you also need to make sure your mmc stays high available. Not an option for me.
I find this method the most appropriate as is it similar to standard exception handling in programming. Manage your exception when you need to and never let them pass silently. When needed send some via mail.
This approach is not bad but not my favorite because lot of times you will see "fake exception" coming in that you need to filter. One example is when a client stops the connection to mule (closing the browser for example) you will get a socket exception that mule cannot write back, this is totally normal and I don't think you want to be spammed by this kind of mail. If you really want to use this system than keep in mind you will need to filter non critical exceptions.
Hope this helps

Re-getting POP3 messages

I am using Peter Huber's POP3 client to connect to gmail and download messages.
The inboxes being accessed are transactional inboxes used only for code-access. That is, a message comes in with a order file attached, code will process it and then delete the message. One stipulation of the code though was a DEBUG flag, which if set would prevent the code from deleting the message so that you can run the program again later without the debug flag and reprocess the message. So, in my code I have
If Not Arguments.Debug Then pop.DeleteEmail(eid)
This works fine. Problem is, even when not deleting the message, running the program a second time will not re-retrieve the message, even though if I login to gmail and look at the inbox, it is still there. The only way I can get the program to see the message again is to forward the message back to the same inbox. But in Peter's code I do not see anywhere where he is keeping track of seen messages between sessions.
Is this something that is done on gmail's end? Refusing to deliver a message to the same client a second time? If so, is there any way I can change my gmail account so that it will always show all messages in the inbox to a client when retrieving the list of messages, even ones already "seen"? I don't see anything in the gmail settings screen.
UPDATE: I tried adding a method to send a RSET command to the server, as per this comment on the codeproject page. I then call my new Reset() method after retrieving my messages but before disconnecting, ... but I still have the same problem.
Okay... found a "sort of" answer after reading through pages of the comments on the codeproject project.
According to this comment, the RSET command does not actually do anything when you are dealing with gmail's servers.
The "answer" is to prepend your username with the string "recent:", so instead of logging in with [myaccount#gmail.com] you log in with [recent:myaccount#gmail.com]. Rather hackish, ... but it works.