I am getting this error when using wwsmtp to send email via mailgun using port 587 Unable to read data from the transport connection: net_io_connectionclosed. have tried port 465 and with and without SSL Credentials appear to be correct in both Mailgun and domain. Any suggestions as to what else to try?
Check your firewall - your app or SMTP at all may be blocked from arbitrary applications.
I know it works with MailGun - you're receiving emails from this message board from FoxPro with wwSmtp and Mailgun.
Also check your port configuration in the MailGun configuration settings for your domain. I connect to MailGun for TLS via port 587.
+++ Rick ---
using port 587 wwsmpt ver 8 domain settings verified by Mailgun firewall off
Can you show me the command you use to connect to Mailgun? Are you adding any headers?
There's nothing special there. Just set the mail server, UseSsl, receipient and send and body.
If you have connection issues it's either a domain name issue (unlikely given you're using mailgun) or a network/router/firewall issue from the app.
+++ Rick ---
Using the same code, if I set the Mailgun smtp email credentials up as a sub-domain in Mailgun, it sends the email just fine. If I set up the Mailgun email credentials as a smtp user in a domain, I get the error. I'm not sure why and have been waiting 2 days to talk to someone in Mailgun Support. The reason this matters is to create a sub-domain in Mailgun, one has to add 5 records to the domain. Sending the emails as a user in a domain only requires 1 record in mailgun. We are trying to use Mailgun to send tmeils for hundreds of customers and the difference in the file maintenance requirements is significant. Not impossible, just a pain.
Not quite sure what that means.
Personally I use Mailgun with several different domains with each having their own set of credentials. I never had to set up anything special for these just making sure the various DNS headers are set up correctly. It's possible Mailgun is blocking based on incomplete DNS configurations (ie. SPF, DKIM etc.)...
After your last message I did go back and ran the sample that comes with Client Tools and Web Connection just to make sure (it's set up for Mailgun) and that worked without issue with my credentials.
The odd thing about what you described is the "No Connection Error", that seems to suggest the server is not connecting at all on the port you're using. It's possible that Mailgun selectively aborts the connection if there's a problem with the account or DNS config - just seems odd as that's an auth/app concern vs. a network protocol issue which the error seems to point at.
+++ Rick ---
Are your credentials configured as a user in a domain (customer@mydomain.net) or as a sub-domain (customer@mysubdomain.mydomain.net). I haven't been able to make the first example work in Mailgun. I should be able to send from multiple users in a single domain e.g. customer1@commondomain.net, customer2@commondomain.net, etc. But I have been unable to do that. I have to create a subdomain as a domain in Mailgun e.g. info@customer1.commondomain.net or info@customer2.commondomain.net. To set up emails for multiple customers, I have to create a subdomain for each customer as opposed to just creating a user address for each customer. Either way should work, but they don't. There's a good possibility I am not configuring the DNS settings correctly. That is what I am waiting to talk to Mailgun about. The reason for using a single domain we can control is because we generally don't have access to the customers DNS records and if you said DNS to most of them you would just get a blank stare.
All of mine are main top level domain addresses.
- messageboard@myTopLevelDomain.com
- support@myTopLevelDomain.com
- support@myTopLevelDomain2.com
I would think that using subdomains would be problematic for DNS SPF/DKIM validation.
+++ Rick ---
So far I have be able to get by with multiple SPF, MX, Dkim, & Cname records, but it has not been tested with more than 3. It's not the way I prefer to go, but I also don't want to buy 132 domains. Thus the concept of multiple users per domain is far more appealing. If I get it solved, I will let you know.
Not sure what you mean. You should be able to use the root domain, and only configure that. If that's not working for some reason you might have to contact MailGun and see if they can help.
That's what I do - I have 15 subdomains, but I send email through the top level domain for all of them which is common and generally accepted. I also 3 top level domains and those send emails with their respective top level domain. This definitely works, and it works with wwSmtp as well (it's what I do here on this message board).
If all else fails try running a network trace with Wireshark or another possibility use MailGun's HTTP API to send messages instead of SMTP.
+++ Rick ---
I'll play with it this weekend and see what I can do. I was going to catch replies using Mailgun routes to send the reply back to their default email. For most of them that is Gmail. The whole idea is to provide them a standard email setup that avoids the restrictions of Gmail. Plus most of them can't remember their passwords anyway. And Gmail doesn't play well with legacy applications.
Yeah I hear 'ya. Email has become a real morass and letting people provide their own email is problematic both in terms of security and just getting the info right. The only place where this works at all these days is really for desktop applications. For everything else the server has to manage this with 'passthrough' messages sent from a central email address.
But if you're sending messages generically that should just work, but make sure the DNS is set right or emails will just bounce straight to spam or get outright rejected by the target servers.
Heck even with passing DKIM/SPF records I still get a few rejections from some small mail servers that are not checking correctly or using old DNS blacklists. Email is crazy unreliable unless you use one of the major services to send and DNS is set up correctly.
+++ Rick ---
When I look at api code examples from Mailgun or Zoho Mail, etc. they are all shown in CURL. In my limited knowledge of languages other than FoxPro, this appears to be a command level language which would have to be run using shell execute. It appears that CURL is built into both Windows 10 and Windows 11. Would it make any sense to attempt to use this or is there some easy way to translate these examples to make them compatible with Client Tools and VFP?
CURL is just a commandline tool that can execute HTTP requests (and many other IP related things) - you have to translate the parameters that are passed into a wwHttp
call. It's pretty easy - you'll have 3 things: URL, Headers (use .AddHeader()
) and the content. If I recall MailGun uses form variables so you can use AddPostKey(key, value)
for each value, or if they use JSON, you can use AddPostKey(lcJson)
(or if you're using the newest version just use .Post()
and pass the lcData
parameter with the JSON).
+++ Rick ---