HI All,

Me again.  Thanks, Benoit, for your response.   I finally managed to get
some time to set up an eclipse project and build a custom mailet, I just
wanted to start with a simple mailet that would log some details of the
incoming emails so that I can make sure the deployment is sound.  Sadly I
don;t see the mailet loading, but I do see it on the classpath.

I am running this on linux, using docker for the James server.  I have
attached the custom-mailet jar file I have built, and the logs I have taken
from the server.  Based on what I have seen, the standard build of James
uses SLF4J, but I can create a custom logger if I were to use log4j, the
docker container does not have a log4j config, but rather seems to use
logback, due to using it in a cluster.  SO not really sure how I can get my
mailet logging on the container.

Also, the log file seems to load my custom jar, but I don;t ever see the
registration of the matcher and my mailet class, so not sure it's actually
loading.

Any hints or tips on where to go would be greatly appreciated.

link to jar file:
https://drive.google.com/file/d/1QcYf3_LhIjyslFTlfJCHQDjuzp085vWq/view?usp=sharing
(Google doesn't like jars_

Kind Regards

Mark


On Tue, 22 Aug 2023 at 15:38, Benoit TELLIER <btell...@linagora.com> wrote:

> https://github.com/apache/james-project/tree/master/examples/custom-mailets is
> likely the best place to start.
>
>
> Nice to see your enthousiasm!
>
> --
>
>
> Best regards,
>
>
>
> Benoit TELLIER
>
>
>
> General manager of Linagora VIETNAM.
>
> Product owner for Team-Mail product.
>
> Chairman of the Apache James project.
>
>
>
> Mail: btell...@linagora.com
>
> Tel: (0033) 6 77 26 04 58 (WhatsApp, Signal)
>
>
> On Aug 22, 2023 6:24 PM, from Mark Andrews Hi All,
>
> I have an interesting problem that I am trying to resolve, that requires me
> to write custom code to catch emails sent to an SMTP server, and then
> process them.
>
> I have many years of Java experience and came across Apache James as a
> possible way to achieve this.
>
> I guess after looking at all the documentation and reading through the
> site, what I am left asking myself is 'How do I build a mailet to do what I
> want, from scratch, as a Proof of Concept in the first instance, and then
> how do I develop it into a final solution.
>
> If anyone can point me in the right direction for this, I am more than
> happy to write a blog article, or post detailing the process so that it can
> be added to the Apache James site.
>
> Kind regards
>
> Mark Andrews
> Solutions Architect | Internet Solutions
> mobile:  +44 7747035866 <+44+7747035866>
> address:  Chichester, West Sussex
>
18:57:58.596 [INFO ] o.a.j.CONFIGURATION - Load extra system properties file conf/jvm.properties
18:57:58.924 [INFO ] o.a.j.CONFIGURATION - Loading configuration org.apache.james.JPAJamesConfiguration@616fe72b
18:58:01.598 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/james-database.properties
18:58:01.804 [INFO ] o.a.j.u.ExtendedClassLoader - Loading custom classpath resource /root/extensions-jars/README.md
18:58:01.805 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/extensions.properties
18:58:03.214 [WARN ] o.a.a.b.BrokerService - Store limit is 102400 mb (current store usage is 0 mb). The data directory: /root/var/store/activemq/brokers/KahaDB only has 1674 mb of usable space. - resetting to maximum available disk space: 1674 mb
18:58:03.215 [WARN ] o.a.a.b.BrokerService - Temporary Store limit is 51200 mb (current store usage is 0 mb). The data directory: /root/var/store/activemq/brokers only has 1674 mb of usable space. - resetting to maximum available disk space: 1674 mb
18:58:03.253 [INFO ] o.a.j.q.a.EmbeddedActiveMQ - Started embedded activeMq
18:58:03.272 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/activemq.properties
18:58:03.274 [WARN ] o.a.j.m.q.a.ActiveMQQueueModule - Could not find activemq configuration file, using default configuration
18:58:10.638 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/webadmin.properties
18:58:11.182 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/healthcheck.properties
18:58:11.764 [INFO ] o.a.j.StartUpChecksPerformer - StartUpChecks all succeeded
18:58:11.821 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/jmx.properties
18:58:11.848 [INFO ] o.a.j.d.d.DNSJavaService - Autodiscovery is enabled - trying to discover your system's DNS Servers
18:58:11.869 [INFO ] o.a.j.d.d.DNSJavaService - Adding autodiscovered server /192.168.1.1:53
18:58:11.870 [INFO ] o.a.j.d.d.DNSJavaService - Adding autodiscovered search path ultrahub.
18:58:11.872 [INFO ] o.a.j.d.d.DNSJavaService - DNS Server is: 192.168.1.1
18:58:11.937 [INFO ] o.a.j.d.d.DNSJavaService - Registered cache, resolver and search paths as DNSJava defaults
18:58:12.335 [INFO ] o.a.j.m.m.MemoryMailRepositoryStore - JamesMailStore init... org.apache.james.mailrepository.memory.MemoryMailRepositoryStore@261099e1
18:58:12.362 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.372 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet PostmasterAlias instantiated.
18:58:12.381 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RelayLimit=30 instantiated.
18:58:12.384 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Null instantiated.
18:58:12.385 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.390 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
18:58:12.418 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.422 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
18:58:12.424 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.442 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
18:58:12.443 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.494 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
18:58:12.506 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/error
18:58:12.512 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
18:58:12.513 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/error
18:58:12.588 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
18:58:12.618 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.622 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RemoveMimeHeader instantiated.
18:58:12.623 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.634 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RecipientRewriteTable instantiated.
18:58:12.636 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
18:58:12.657 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Sieve instantiated.
18:58:12.660 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
18:58:12.663 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet AddDeliveredToHeader instantiated.
18:58:12.664 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
18:58:12.684 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet LocalDelivery instantiated.
18:58:12.688 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher HostIsLocal instantiated.
18:58:12.691 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
18:58:12.692 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher relay-allowed instantiated.
18:58:12.694 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
18:58:12.700 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.728 [INFO ] o.a.j.q.a.m.ActiveMQMetricCollectorImpl - collecting statistics for ActiveMQ.Statistics.Destination.outgoing
18:58:12.922 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RemoteDelivery instantiated.
18:58:12.924 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.927 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
18:58:12.928 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.930 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
18:58:12.932 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.940 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
18:58:12.946 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/address-error
18:58:12.946 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
18:58:12.946 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/address-error
18:58:12.960 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
18:58:12.967 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.973 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
18:58:12.989 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:12.999 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
18:58:13.000 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:13.007 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
18:58:13.008 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/relay-denied
18:58:13.009 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
18:58:13.009 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/relay-denied
18:58:13.018 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
18:58:13.021 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
18:58:13.023 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
19:03:06.577 [INFO ] o.a.j.CONFIGURATION - Load extra system properties file conf/jvm.properties
19:03:06.878 [INFO ] o.a.j.CONFIGURATION - Loading configuration org.apache.james.JPAJamesConfiguration@616fe72b
19:03:09.295 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/james-database.properties
19:03:09.729 [INFO ] o.a.j.u.ExtendedClassLoader - Loading custom classpath resource /root/extensions-jars/custom-mailets-3.8.0.jar
19:03:09.730 [INFO ] o.a.j.u.ExtendedClassLoader - Loading custom classpath resource /root/extensions-jars/README.md
19:03:09.732 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/extensions.properties
19:03:11.304 [WARN ] o.a.a.b.BrokerService - Store limit is 102400 mb (current store usage is 0 mb). The data directory: /root/var/store/activemq/brokers/KahaDB only has 1671 mb of usable space. - resetting to maximum available disk space: 1671 mb
19:03:11.305 [WARN ] o.a.a.b.BrokerService - Temporary Store limit is 51200 mb (current store usage is 0 mb). The data directory: /root/var/store/activemq/brokers only has 1671 mb of usable space. - resetting to maximum available disk space: 1671 mb
19:03:11.306 [INFO ] o.a.j.q.a.EmbeddedActiveMQ - Started embedded activeMq
19:03:11.369 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/activemq.properties
19:03:11.374 [WARN ] o.a.j.m.q.a.ActiveMQQueueModule - Could not find activemq configuration file, using default configuration
19:03:14.753 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/webadmin.properties
19:03:15.392 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/healthcheck.properties
19:03:15.965 [INFO ] o.a.j.StartUpChecksPerformer - StartUpChecks all succeeded
19:03:16.014 [INFO ] o.a.j.CONFIGURATION - Load configuration file /root/conf/jmx.properties
19:03:16.039 [INFO ] o.a.j.d.d.DNSJavaService - Autodiscovery is enabled - trying to discover your system's DNS Servers
19:03:16.049 [INFO ] o.a.j.d.d.DNSJavaService - Adding autodiscovered server /192.168.1.1:53
19:03:16.050 [INFO ] o.a.j.d.d.DNSJavaService - Adding autodiscovered search path ultrahub.
19:03:16.051 [INFO ] o.a.j.d.d.DNSJavaService - DNS Server is: 192.168.1.1
19:03:16.119 [INFO ] o.a.j.d.d.DNSJavaService - Registered cache, resolver and search paths as DNSJava defaults
19:03:16.385 [INFO ] o.a.j.m.m.MemoryMailRepositoryStore - JamesMailStore init... org.apache.james.mailrepository.memory.MemoryMailRepositoryStore@3465edf9
19:03:16.410 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.417 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet PostmasterAlias instantiated.
19:03:16.421 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RelayLimit=30 instantiated.
19:03:16.424 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Null instantiated.
19:03:16.425 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.429 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
19:03:16.459 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.463 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
19:03:16.464 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.478 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
19:03:16.479 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.508 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
19:03:16.517 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/error
19:03:16.519 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
19:03:16.519 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/error
19:03:16.547 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
19:03:16.561 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.564 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RemoveMimeHeader instantiated.
19:03:16.565 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.573 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RecipientRewriteTable instantiated.
19:03:16.576 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
19:03:16.594 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Sieve instantiated.
19:03:16.595 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
19:03:16.599 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet AddDeliveredToHeader instantiated.
19:03:16.600 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher RecipientIsLocal instantiated.
19:03:16.611 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet LocalDelivery instantiated.
19:03:16.614 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher HostIsLocal instantiated.
19:03:16.616 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
19:03:16.617 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher relay-allowed instantiated.
19:03:16.618 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToProcessor instantiated.
19:03:16.622 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.648 [INFO ] o.a.j.q.a.m.ActiveMQMetricCollectorImpl - collecting statistics for ActiveMQ.Statistics.Destination.outgoing
19:03:16.781 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet RemoteDelivery instantiated.
19:03:16.790 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.794 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
19:03:16.798 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.804 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
19:03:16.806 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.816 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
19:03:16.817 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/address-error
19:03:16.818 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
19:03:16.819 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/address-error
19:03:16.824 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
19:03:16.838 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.840 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet MetricsMailet instantiated.
19:03:16.841 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.843 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet Bounce instantiated.
19:03:16.844 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
19:03:16.850 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentObjectRepository Store
19:03:16.851 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentObjectRepository opened in /root/var/mail/relay-denied
19:03:16.851 [INFO ] o.a.j.r.f.AbstractFileRepository - Init org.apache.james.repository.file.FilePersistentStreamRepository Store
19:03:16.852 [INFO ] o.a.j.r.f.AbstractFileRepository - org.apache.james.repository.file.FilePersistentStreamRepository opened in /root/var/mail/relay-denied
19:03:16.855 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Mailet ToRepository instantiated.
19:03:16.857 [INFO ] o.a.j.m.l.AbstractStateMailetProcessor - Matcher All instantiated.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscr...@james.apache.org
For additional commands, e-mail: server-user-h...@james.apache.org

Reply via email to