MailgunX - Send Emails via Mailgun (Open Source)

MailgunX is an implementation of the Mailgun (https://www.mailgun.com) API by Rackspace. This is far superior to using SMTP socket as it is faster.

Highlights:

Easily send email messages using Mailgun by creating an instance of Mailgun.SendEmail thread class. Emails are sent in the background via thread.

We will add additional Mailgun functionality over time as needed in our projects.

See: https://github.com/1701software/MailgunX

MIT Licensed

Nice share man!

You happen to know of any clones of mailgun, that can run on your own servers to interact with the SMTP server on your own server?

Mailgun is basically the app Rackspace has setup in front of SMTP servers correct? So you can send mail via API? Wondering if you have seen anyone implement something similar for their own SMTP servers?

Yes it is technically an API in front of an SMTP server. However it is a very capable SMTP server that is widely known around the Internet. They work hard to protect from sending spam so their IP addresses tend to have better deliverability rates then if you started your own SMTP server. With a little time though that problem works itself out as you gain reputation.

Ultimately running a SMTP server is a lot of work. I run a dedicated mail server for customers and spam takes up more time than I would like.

I have not seen an API front end to a traditional SMTP server but you could build one in Xojo that fit your needs relatively easily.

Thanks Phillip,

I guess I will soon terminate my mandrill subscription. (currently using XoDrill )

I’m currently writing a SendGrid implementation for Xojo.
Users will then have a choice between Mailgun, Mandrill and SendGrid

Awesome Jrmie.

All of these options are better than sending through your home ISP, Yahoo, or any other free SMTP service. These are transactional systems designed to help you scale and most importantly monitor your email usage.

I had missed it! Thanks Phillip.

And maybe MailJet? :wink:

interesting indeed! I guess it is well integrated with European ISPS. The quick creation of responsives emails with a simple language seems well also.

The main problem with all mentioned companies is that they have changing IP addresses for sending. Now and then I get a bounce from Spamcop for my SendGrid mails. Unfortunately, a fixed IP address is way too expensive for my 10-20 mails per day.

You would be better off just using a normal mail server provided by a hosting provider in that case.

In my projects we are sending thousands of emails a day.

Well, the number of mails is not the only criterion. I deliver less than 20 email a day to customers to get their license and download information from a fixed IP address, but yet, GMail, Hotmail and some others insist to throw that in the spam folder. As a result I have issues with customers asking for that, in spite of a prominent advice to look into spam on the site.

I am going to implement Mailgun in the hope delivery rate will be better.

The problem with running your own SMTP server(fixed IP or not) for this is that you might easily be blacklisted by (for example) SORBS, so almost all your emails will get into peoples spam folder. Good luck getting white listed again :wink:

@Michel Bujardet

I send out probably 700k emails a month on my own self hosted email.

You have to make sure you have DKIM, SPF, DMARC setup and it is correct. Make sure your whois information for the domain is visible. Make sure your PTR is set correctly so reverse lookup shows the domain you are mailing from. You have to make sure you track clicks and opens, and bounces. Because you can not repeatedly send to emails that bounce. With hotmail, etc… you are even in trouble if an email inboxes and never get opened. So you have to get rid of the unopens and non clicks. But you need to track both, because open rate is not reliable at all… But, if you track by clicks, and they aren’t clicking links in your emails over the course of a month… they are more then likely dead as well, or not reading the emails at all.

When you start out sending you need to warm an IP address up. So you will never send over 500 per hour.

The problem you will find with Outlook, Hotmail, Live email addresses is that they will block a whole massive IP block… just because your host may have had some spammers on it. Then, if you get the block removed… they screw up a lot of times and block it again, just because it was blocked before. It is like they have an automated script that just resets all the dang blocks again every month.

My delivery rate is higher then it was with GetResponse, Aweber, Mandril, Sendgrid, Mailerlite, and a few others… The only thing that has given me an equal or better delivery rate was SES. But… SES and many others have a heart attack if you send out emails that they think are affiliate related. They also have a fit even if your own site has an affiliate program with some affiliate network that some other morons spammed links to. Yet the emails on my list are all legit emails that were from customers or opt-ins. I wa ssending out 37k emails on mandril, with a 98% delivery and a .0002% complaint rate. Still got canned from them. The complaints weren’t even friggin complaints most of the time. Most of the time it was their fault. They consider a delivered email a complaint if it ends up in the bulk folder of Yahoo, not even an actual complaint. So less then 10 complaints on each 37k send… they should have been happy as could be. Yet they still canned me.

Each email I send out goes out to about 6k to 37k people, depending on what I am sending out. My lists are heavily segmented.

Been sending email for a lot of years, because I have made a lot of software products that were strictly for marketing online, so I have seen just about everything they can throw at me. But the actual spammers make it hard for legitimate list owners at times.

I will definitely work on that. Thank you.

Thanks for sharing MailgunX Phillip.
Can I just check that if I wanted to send a batch of say 100 emails with address taken from a listbox, I just loop through them calling the same code that’s currently in the send button for each one?
Is there anything else I need to do/watch out for to bulk send emails?

Yeah that would work. Keep in mind the socket is asynchronous so just because you initiated a send on all of them does not mean they all completed yet. If it were me I would add the 100 to a queue and have a background thread running through the queue at all times. Then you can expand it to be used for any outgoing email.

Regarding volume we are sending over 10k emails a month using MailgunX with great delivery rates for a Xojo based project.

Can MailgunX send attachments? The wMain window in the app has a field for an attachment, but no mention of it in the code for sending the email.