bbottema / simple-java-mail

Simple API, Complex Emails (Jakarta Mail smtp wrapper)

Home Page:http://www.simplejavamail.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: cli expected --mailer arguments duplicated 3 times

basinilya opened this issue · comments

When I try to send via command line and provide --mailer:trustingAllHosts true it fails:

$ ~/cli-module-6.6.1-standalone-cli/bin/sjm send --email:forwarding "C:\progs\outlook-message-parser\src\test\resources\test-messages\attachments.msg" --email:from X basin@acme.com --email:to X basin@acme.com --mailer:withSMTPServer gate1.acme.com 465 "" "" --mailer:trustingAllHosts true --mailer:withTransportStrategy TransportStrategy.SMTP_TLS
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.IllegalArgumentException: provided 0 arguments, but need at least 1
        at org.simplejavamail.internal.util.Preconditions.assumeTrue(Preconditions.java:49)
        at org.simplejavamail.internal.clisupport.CliCommandLineConsumer.consumeCommandLineInput(CliCommandLineConsumer.java:67)
        at org.simplejavamail.internal.clisupport.CliSupport.runCLI(CliSupport.java:44)
        at org.simplejavamail.cli.SimpleJavaMail.main(SimpleJavaMail.java:31)

Debugging shows that it expects 3 instances of --mailer:trustingAllHosts and for the 1st one it successfully reads the input argument, but for the 2nd one it thinks zero arguments were provided

Thank you for your report, I found and fixed the bug. Unfortunately, I'm in the middle of the 7.0.0 release and it's not easy for me to do intermediary releases (the release pipeline doesn't support it currently). So it might take a while for this fix to become public.

Btw, your last argument should be just SMTP_TLS.

7.0.0 just released with the fix for this.