Javamail vs sendmail during mass mailing

I am writing a Java email application to send emails to send from 50,000 to 100,000 users per day.

In the current plan, you must delegate the transfer to the sendmail delegate (on the local unix server).

From our testing, sendmail sends a maximum of 5 messages per second.

Will JavaMail be faster?

Does anyone know what a faster way to send emails is? We want this process to be as fast as possible.

Edit: BTW, pdf will also be attached

+4
source share
4 answers

You are not compared to the like. JavaMail discusses SMTP for transmission to the nearest mail server. Sendmail is the mail transfer agent responsible for routing emails to their destination.

General setup is a Java application that uses JavaMail to relay email through SMTP to a Sendmail server. These two are not competitors, they are used together. The sendmail server should be able to accept deliveries from javamail faster than any java application can create them, but then it provides them asynchronously with its own speed.

+6
source

It might be a little too old, but I just managed to get javamail and sendmail to work together. It is actually very simple, and I was stupid because I did not do it faster ...

Let's ignore sendmail a bit. How can we send an email through javamail? There are tons of tutorials online, but here's how to do it:

  • Create a session with the appropriate authenticator;
  • Create a MimeMessage object (here, where you add all recipient addresses);
  • Call Transport.send () with your message.

What if your SMTP server sends emails to up to 100 recipients (for example, mine)? This is when sendmail comes into play. You can think of sendmail as your own SMTP server. Therefore, install it first. If you are using Ubuntu (like me), just do:

sudo apt-get install sendmail 

Installation completes pretty quickly. After that, sendmail is ready to use. I did not set up any type of authentication at all, but it is probably a good idea if your server has a public IP address on the Internet. Now, instead of pointing your Java code (which javamail uses) to your SMTP server, just point it to localhost (or to some other computer that you just installed sendmail).

You can even test your sendmail installation using a regular mail client (thunderbird, Outlook, Windows Mail, or any other boat on your boat). Just configure your SMTP server on the computer where sendmail is installed. Guess what? He works!

Just do not use this to send letters to the whole world ...;)

+4
source

Firstly, I believe that this is for legitimate reasons, not a newsletter?

Sendmail sends emails very, very fast. What isn’t so fast is the DNS lookup needed to find the mail servers for the domain - you need to make an MX request for each - and that will be fine with the 5 messages you are reporting. 2.

When that is said, it is probably best for you to use standard high-performance mailing list software in which you create a message using javamail and tell the mailing program to send it to everyone. Also an ally, for example, Google Mail, because they scale well to actually send them all. Google Apps for Java lets you send messages from the Google Cloud.

In ancient history, when I worked with this Majordomo, it worked great with sendmail. ezmlm works well with qmail (but probably left now) and I think mjmlm works well with postfix.

+1
source

If we use the Tranport.send () - Static method in the Java mail program to send letters, this method performs a confirmation of communication for each of the email addresses in the list. (Acknowledgment: request from the client → Response from the server → Confirmation.), That is, each time it closes the connection to the SMTP mail server. Here is a way to improve performance. Thanks to which we can only acknowledge once, and this greatly reduces SMTP traffic. And send mail to all recipients in one shot, Pl refers to SCR # A for SMTP traffic for this scenario. Here is the code for reference,

Instead of <

 Transport.send(msg); 

We should use the code snippet below,

  msg.saveChanges(); // implicit with Transport.send() Transport tr = session.getTransport("smtp"); tr.connect(smtphost, username, password); msg.saveChanges(); // don't forget this tr.sendMessage(msg, msg.getAllRecipients()); tr.close(); 

To send bulk emails.

Here you can see the network traffic using the wired shark tool.

What is needed to configure this is with the mail server. -> Local m / c installed using the Shark Shark tool and Apache tomcat 6.0, and it should be able to ping your mail server say relay.abcxyz.com

Now run the test site for both cases.

+1
source

All Articles