Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java mail bounced back mail's address

Tags:

java

I have to send messages to many clients. But many of them bounce back. I want a list of those email addresses. How can I get that list from my Java application?

like image 404
user1092110 Avatar asked Dec 11 '11 10:12

user1092110


People also ask

Why is my email address bouncing back?

What causes an email to bounce back? There are a variety of reasons for email bounce backs include full inboxes, servers that aren't responding, sends to email addresses that no longer exist, invalid email addresses, and sends to fake email addresses.

Do invalid email addresses bounce back?

Emails sent to incorrect or invalid email addresses are likely to bounce. If an address entered during sign up includes typos or emissions, the email will bounce because the address doesn't exist.


1 Answers

Make a special email address [email protected] where you will capture all bounced emails for analysis.

Add the following header to your sent emails:

Return-Path: <[email protected]>

Now the emails are going to bounce back to that address.

Read emails at that address from your java program from time to time, for example via IMAP (or depending on your server via a notification interface/whatever), and when you see an email address record it in your database

Note that if you are doing a newsletter app, you should not blacklist the email from the first time, but make count it's bounces, and blacklist it after 3-4 bounces (some people set their email to bounce when they go in vacation and such, so they need special taking care of).

like image 54
clyfe Avatar answered Sep 21 '22 05:09

clyfe