Hi all, just to let you know that both of my mailets worked as hoped. @Garry Hurley, it turns out that the MimeMessage passed into the bounce mailet is actually the original email not the bounce email, which saves a bit of work!
Kind regards Matt On Fri, 1 Jul 2022 at 09:33, Matt Pryor <pr...@international-presence.com> wrote: > Many thanks Benoit, Garry and Karsten for the helpful responses! > > Matt > > > > On Thu, 30 Jun 2022 at 18:34, Garry Hurley <garry.hurley...@gmail.com> > wrote: > >> Actually, the bounce notification may have its own message ID, so you >> might >> have to dig through it a little bit more than just taking >> mail.getMessage().getMessageID(). You might have to parse the body of the >> message or the header to find the id of the original message that bounced. >> This is especially true if the mail is routed through a relay server or is >> sent outside of the network. If both sender and recipient are local to the >> James server, the bounce notification is easier to connect, but once >> another server node is involved, that notification may not connect back to >> the original message as well without digging through the headers. >> >> On Thu, Jun 30, 2022 at 1:01 PM Otto, Karsten Andreas >> <karstenandreas.o...@akquinet.de.invalid> wrote: >> >> > On 30.06.22 3:48 PM, Matt Pryor wrote: >> > > Hi there, we are currently running James 3.4.0. >> > > >> > > I am looking to create two implementations of Mailet to do the >> following: >> > > >> > > 1) Store message ID and a custom header in a database table after >> email >> > has >> > > been submitted via smtp >> > > 2) Update table with failed status if the email bounces >> > > >> > > Please can you let me know how I can obtain the message ID, is it in >> an >> > > attribute and if so which one? >> > > >> > To get the Message-ID, you must first get the message from the mail, >> > i.e. mail.getMessage().getMessageID() >> > But keep in mind that not all messages necessarily have a Message-ID, so >> > this may be null. >> > >> > > Where in mailetcontainer.xml should I define the custom mailets? I am >> > > thinking that the first one should go in the transport processor, >> before >> > > RemoteDelivery mailet (but after the DKIM mailet), and the second >> should >> > go >> > > in the "bounces" processor, after DSNBounce but would appreciate >> > > confirmation. >> > > >> > Basically sounds good, really depends on your mailetcontainer.xml, I >> > don't know what the default was in 3.4.0. Do you only want to track >> > outbound mails coming from local users going to remote servers? Or also >> > inbound mails coming from remote servers to local users? What if they >> > go from local to local? >> > >> > Best to draw the graph of ALL possible paths a mail can travel, starting >> > from the "root" processor and keeping in mind it could switch to "error" >> > at any time. (Some branches are easy to overlook, e.g. bounceProcessor >> > on RemoteDelivery if you use this option.) The graph will tell you where >> > you need to place your mailets. >> > >> > >> > > Many thanks for your help. >> > > Matt >> > > >> > Cheers, >> > Karsten >> > >> > --------------------------------------------------------------------- >> > To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org >> > For additional commands, e-mail: server-user-h...@james.apache.org >> > >> > > > -- > Matt Pryor > Software Developer > > The International Presence Group of Companies > EMAIL: pr...@presencebpm.com > URL: www.International-presence.com > > > -- Matt Pryor Software Developer The International Presence Group of Companies EMAIL: pr...@presencebpm.com URL: www.International-presence.com