Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Show changed files | Details | Compare with Previous | Blame | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
37483 37 d 6 h amit /trunk/profitmandi-dao/src/main/ mail: migrate mail_outbox SENDGRID rows to RELAY (applied to production)

SENDGRID never meant SendGrid -- resolveSender() already routed it to the
Workspace relay, which is why outbox mail kept being delivered while direct
JavaMailSender injections failed against the real, dead SendGrid bean. So this
relabels rows without changing where anything is sent.

Applied to hadb1 2026-08-31 18:10 IST:
before SENDGRID=5956 RELAY=0 GOOGLE=4896 (total 10852)
after SENDGRID=0 RELAY=5956 GOOGLE=4896 (total 10852)
backup dtr.mail_outbox_sendgrid_backup_20260831_1810 (5956 rows)

The one PENDING row (id=26838) migrated cleanly and still routes to the relay.
Only GOOGLE and RELAY remain in the column. Rollback statement is in the script.

The comment claiming legacy SENDGRID rows exist is now false and has been
corrected; SendGrid appears nowhere in the codebase.
 
37478 37 d 6 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/mail/ mail: MailOutboxService implements MailQueue

Adds the single entry point, queue(MailRequest). The twenty-odd queueMail*
overloads remain as delegates because ~112 call sites use them, but they now
funnel through one path rather than each building their own argument list.

Selecting the transport moves here too: MailSenderType.GOOGLE maps to the
authenticated sender, anything else to the relay.
 
37473 37 d 7 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/mail/ mail: retire the SENDGRID sender label

SendGrid was never actually used by the outbox -- resolveSender() already fell
through to the Workspace relay for it, which is why outbox mail kept working
while direct JavaMailSender injections failed.

Two senders remain, each named for what it is:
GOOGLE - authenticates as sdtech@smartdukaan.com; AuthenticatedIdentityMailSender
rewrites every From to that identity, because Workspace binds an
authenticated session to one address and rejects any other with
'535 Authorization failed: Authenticated user is not authorized to send mail'
RELAY - Workspace relay, no auth, authorised by source IP, may send as noreply@

Default convenience methods now route to RELAY explicitly rather than through a
label that named a provider we do not use.
 
37361 49 d 3 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Mail outbox: one transaction per mail, retry once more, stable Message-ID

processPendingMails ran the whole batch in a single REQUIRES_NEW transaction, so a
crash mid-batch rolled back the status of every mail already delivered in that cycle
and the next run re-sent them.

- Split into selectPendingIds (read-only) plus sendOne per mail, each REQUIRES_NEW via
a @Lazy self-reference so the proxy actually applies. Outcome is committed as soon
as it is known; a crash now loses at most the mail in flight.
- MailOutbox.selectPending retries FAILED rows once more (retryCount < 2).
- Stable per-row Message-ID so a retry arrives as the same message and the receiving
server can collapse it instead of showing a duplicate.
 
36399 163 d 9 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Replace mailSender (SendGrid) with gmailRelaySender - SendGrid API key expired/revoked  
36250 178 d 16 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Sender-type-aware mail cleanup: 6 months for SendGrid/Relay, 1 month for Google SMTP  
36249 178 d 16 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/mail/ Route all SendGrid mail through Google Workspace Relay  
36245 178 d 16 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/mail/ Add Google Workspace SMTP Relay as third mail sender (RELAY) alongside SendGrid and Google  
36067 195 d 11 h aman /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix:Duplicate Mail Sending issue and bug fixing  
36059 196 d 5 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix mail outbox: load by ID instead of selectPending filter to prevent cascade failure  
35960 214 d 11 h amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/mail/ MailOutboxService: dev recipient guard (no mail to real users in non-prod), fix self-invocation for @Async/@Transactional via @Lazy self-proxy  
35956 214 d 11 h amit /trunk/profitmandi-dao/src/main/ Mail outbox pattern: persist mail in transaction, send async after commit. Fixes lock contention between /cancelOrder and /om/addBillingDetailsForGrouppedOrders caused by SMTP calls inside transactions holding DB locks.