textbelt icon indicating copy to clipboard operation
textbelt copied to clipboard

Standalone server starts and serves back "success" messages, but no texts are received

Open pgibler opened this issue 7 years ago • 6 comments

I'm in the US for what it's worth.

If no one has an answer I'll start looking into this one. If someone knows why this doesn't work on standalone servers that would also be great.

pgibler avatar Dec 11 '16 04:12 pgibler

I tried to debug this today but didn't make a lot of useful progress. Just got a better understanding of how textbelter works.

What I'm trying to see is if I can use mutt to send out a text message by itself. Based on what is generated in textbelter, I used the following command + args:

mutt -s txt -e set [email protected] -e set user_from=yes -e set envelope_from=yes -b <phone#>@vtext.com

This forces me to go through the interactive message prompts to write and send my message, which I do. Mutt then outputs a message stating the mail was sent successfully, but I still don't get a text.

I'm not sure what could be causing this. I'll keep looking into it, but if someone has some insight as to what's needed to send a text through mutt, it'd be greatly appreciated as I could debug my own issue much more easily.

pgibler avatar Dec 11 '16 22:12 pgibler

Added the following to my Vagrantfile so DNS resolution would happen in my host:

# Tell virtualbox to forward the NAT engine to intercept DNS requests and forward them to the hosts resolver.
config.vm.provider :virtualbox do |vb|
  vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end

After running mutt again, checking my /var/log/mail.log (mutt logg) gave me some more information:

Dec 12 00:01:19 textbelt-box postfix/smtp[2599]: AE8FBDFFC3: to=<[email protected]>, relay=none, delay=0.07, delays=0.02/0.05/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=txt.windmobile.ca type=MX: Host not found, try again)

All the carriers mutt attempted this with returned the same result.

At this point this issue is clearly not a result of textbelt. However, it would be nice to know the DNS settings for the machine running textbelt. It could help those of us trying to run it standalone.

pgibler avatar Dec 12 '16 00:12 pgibler

After a lot of effort I discovered and fixed a few things. While I'm not sending out smtp directly from mutt to the recipient, I'm ok with my setup now that it works - I'm using Gmail as a relayhost now after fighting for 3 days through weird DNS problems. Not exactly how I want it to work (I'd prefer to send SMTP directly from the machine to the recipient) but at least it works for development purposes.

The first thing I did was check my Windows host machine's DNS settings. Under Network and Sharing Center, I right clicked my adapter and selected Properties. Then, for both IPv4 and IPv6 I did the following:

  1. Right clicked the TCP/IP layer I wanted to fix (IPv4 then IPv6)
  2. Clicked Properties
  3. Clicked Advanced
  4. Selected the DNS tab
  5. Made sure Append primary and connection specific DNS suffixes radio option was selected
  6. Enabled Append parent suffixes of the primary DNS suffix

This fix allowed me to nslookup -type=mx gmail on port 25 from my Windows host machine. That was a good first step, since that traffic had been not working as well.

However, it did not fix hostname resolution from inside the VM.

To fix this, in vagrant, my /etc/resolv.confg contained this line - nameserver 10.0.2.3 I changed that to nameserver 8.8.8.8 and restarted postfix, and I was suddenly able to nslookup -type=mx gmail on the Linux guest machine.

Feeling confident, I tried running textbelt standalone again with node server/app.js. Sadly, I was still getting Connection timed out errors. At least the hostname resolution was working. Still, I got so dismayed I decided to just setup a Gmail relay host. Definitely not what I want (I want to send SMTP directly to the recipient) but it will allow me to develop with textbelt in standalone mode at least.

pgibler avatar Dec 13 '16 15:12 pgibler

I should mention that I also configured postfix to use a port other than 25 in the /etc/postfix/master.cf file for smtp. I replaced this line:

smtp inet n - y - - smtpd

with this one:

9540 inet n - y - - smtpd

Then restarted postfix with this command: /etc/init.d/postfix restart

Did not help the Connection timed out error...

At least I tried a bunch of things before giving up and using a relayhost!

If any devs have any insight as to why the connection keeps timing out, I'd love to hear it. I would definitely prefer to not have a relayhost.

pgibler avatar Dec 13 '16 15:12 pgibler

I'm going to leave this open as I am still hoping for a better solution than being forced to use a relayhost to run textbelter. Namely, I'd just like to send outgoing mail directly to recipients (as I've stated).

pgibler avatar Dec 13 '16 19:12 pgibler

Thanks for debugging this so thoroughly. The mail sending mechanism has always been a headache, and the dependency on mutt is pretty weird.

I have not run this on vagrant before and haven't had issues with hostname resolution, but let's keep this issue open in case it's useful or relevant to someone in the future.

typpo avatar Dec 14 '16 05:12 typpo