Emails not delivered to gmail

Hi

Some people using gmail are not receiving emails from my CUBA app. I suspect this is related to SPF/DKIM.

There is no error in sending the mail through my SMTP provider, because this is gmail server rejecting the mail.

Question is : where can I see gmail mailer-daemon server feedback when the mail is sent from CUBA plaform ?

Example given, when you use linux sendmail command you have a feedback like below in /var/spool/mail/tomcat (depending on your setup).

--3A8AONPi013914.1699439063/node97546-newcpx.jcloud-ver-jpe.ik-server.com--

From MAILER-DAEMON@node97546-newcpx.jcloud-ver-jpe.ik-server.com  Wed Nov  8 11:53:53 2023
Return-Path: <MAILER-DAEMON@node97546-newcpx.jcloud-ver-jpe.ik-server.com>
Received: from localhost (localhost)
by node97546-newcpx.jcloud-ver-jpe.ik-server.com (8.14.7/8.14.7) id 3A8ArrK8020130;
Wed, 8 Nov 2023 11:53:53 +0100
Date: Wed, 8 Nov 2023 11:53:53 +0100
From: Mail Delivery Subsystem <MAILER-DAEMON@node97546-newcpx.jcloud-ver-jpe.ik-server.com>
Message-Id: <202311081053.3A8ArrK8020130@node97546-newcpx.jcloud-ver-jpe.ik-server.com>
To: <tomcat@node97546-newcpx.jcloud-ver-jpe.ik-server.com>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="3A8ArrK8020130.1699440833/node97546-newcpx.jcloud-ver-jpe.ik-server.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--3A8ArrK8020130.1699440833/node97546-newcpx.jcloud-ver-jpe.ik-server.com

The original message was received at Wed, 8 Nov 2023 11:52:52 +0100
from localhost.localdomain [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----

Regards
Michael

Hi,
CUBA emailing uses JavaMailSender to send emails.
In its turn, it uses com.sun.mail as implementation (com.sun.mail.smtp.SMTPTransport class).

That class uses java.util.logging library for logging, so you can’t control logging with logback.xml.
In Tomcat, you can modify tomcat/conf/logging.properties file.
E.g. add these settings:

com.sun.mail.level = FINE

Then you will get messages in the catalina.log Tomcat’s log file:

10-Nov-2023 16:25:09.385 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.protocolConnect useEhlo true, useAuth false
10-Nov-2023 16:25:09.386 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.openServer trying to connect to host "localhost", port 2525, isSSL false
10-Nov-2023 16:25:09.449 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.openServer connected to host "localhost", port: 2525
10-Nov-2023 16:25:09.454 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.ehlo Found extension "8BITMIME", arg ""
10-Nov-2023 16:25:09.455 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.ehlo Found extension "SIZE", arg ""
10-Nov-2023 16:25:09.455 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.ehlo Found extension "SMTPUTF8", arg ""
10-Nov-2023 16:25:09.455 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.ehlo Found extension "AUTH=CRAM-MD5", arg "PLAIN LOGIN ANONYMOUS"
10-Nov-2023 16:25:09.455 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.ehlo Found extension "AUTH", arg "CRAM-MD5 PLAIN LOGIN ANONYMOUS"
10-Nov-2023 16:25:09.459 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.sendMessage use8bit false
10-Nov-2023 16:25:09.463 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.rcptTo Verified Addresses
10-Nov-2023 16:25:09.464 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.rcptTo   abc@example.com
10-Nov-2023 16:25:09.472 FINE [http-nio-8080-exec-11] com.sun.mail.smtp.SMTPTransport.sendMessage message successfully delivered to mail server

See also here: com.sun.mail.smtp (JavaMail API documentation)

Thanks @albudarov

Michael