Decent Free Options for SMTP in Xojo?

I tried using SMTPSecureSocket with gmail and had no success. Using the same exact code with the SMTP Server at my website hosting company, it works fine.

That’s fine for my own stuff. But if I want to have others using my code, I need either a reliable free SMTP option that anyone can use, or something internal to Xojo, if that’s possible.

What’s the best option here? I want it to be a no brainer for the user. Is it possible to create a local SMTP Server that runs inside a Xojo app?

Add instructions in your app manual on how to create and use App Passwords for Gmail. Yes, I have users that can’t do it themselves and the support need help them, so a no-brainer does not exist, people sometimes act like:

- Go to the setup options
- Of the app?
- Yes
- Where?
- Menu, Setup Options.
- Done
- Now press the red button
- In the setup screen?
- Yes
- There are 3 buttons here
- How many are red?
- One
- Press this one
1 Like

The best advice I can give is: don’t. The only SMTP server your software should be contacting is that of your users. If you provide a way for your app to send email through your server, it opens you up to having your server exploited and your domain and/or ip address blacklisted.

There’s no such thing as free in this territory anymore. Spammers have ruined that for everybody. The fees aren’t really due to bandwidth, but reputation defense.

The right way to have your app send email is through an intermediate, such as an API running on your web server. That API then sends the email using a service such as MailGun, SendGrid, or (my personal favorite) Postmark. You should not have your app send to these services directly, because that would require embedding private API keys in your app. If you had to revoke or cycle a key, that feature of your app would break.

I know it’s not what you’re looking to hear, but it’s just the way things are these days.

5 Likes

I get what you are saying about having a separate app send the emails…but then it has to have API keys. If both apps are on the same server, what are the benefits of two apps vs one? (I’m assuming the API keys would be on the server hard drive either way…not embedded in either apps executable)

Thanks Thom.

I totally agree about the spammers ruining this. I would never have it going through my severs. Hoping the user would setup everything to work with Google would not be a good idea as Rick points out. I think I’ll stick with my current solution which opens up the default email client on the system (assuming one has been configured). That has been working incredibly well for me. I’ll just tell users they need a default email client setup on their system to allow the app to send email. I’m not doing bulk emailing or anything like that, so my solution should be good enough.

I wasn’t actually wanting 2 apps, but the SMTP function in the app that is to send email. But given the other responses, I’m going to stay away from that because I don’t want to deal with keys, servers requiring setup that some won’t understand how to do it or simply won’t. And of course if something goes wrong or changes at the server, I’d get the complaints even if the app is working fine.

Your client-side app runs on the user’s device and communicates with your server via an API you define. How that API works is up to you. That API will have the secrets to the third-party API, such as Postmark, so that those secret values never leave your server.

Oh…yeah I was totally assuming this was a web app. Not a client-side app.

1 Like

Oh. Yep, it’d be a lot simpler as a web app.

1 Like