We are using an external commercial smtp server for our newsletters (sending them through .NET components), and they offer two smtp URLs - smtp.critsend.com and fast.critsend.com -, and the second one is reserved for sending singular emails, the first one for bulk.

Using nslookup shows that both resolve to the same 4 IP addresses (fast.critsend.com being an Alias).

Question: (how) is it possible for the smtp relay to distinguish between different names? Is there something in the headers that can be compared to host headers in http protocol (I didn't find any intelligible information for a non-sysadmins)?

The reason I'm asking is because we would like to use one of the IPs in our newsletter script (which works) rather than a name (in order to save DNS requests), and we are wondering about potential problems.

  • "we would like to use one of the IPs in our newsletter script (which works) rather than a name (in order to save DNS requests)" TTL? DNS Cache? What if the provider changes IPs? What if the IP you choose goes down? (They most likely have 4 for DNS round robin/failover). If They gave you a hostname, use a hostname. – Smudge Nov 16 '11 at 10:34
  • We do read them in advance. It's just that for some reason (which we are still trying to find out) the DNS doesn't always answer. So, if the script lookup works, it's fine, and if not, we use the IP. Sorry, I should have elaborated. – Olaf Nov 16 '11 at 10:37
  • OK that kind-of makes sense, but if the DNS doesn't respond you probably have an issue somewhere else. Oh well, each to their own – Smudge Nov 16 '11 at 10:39
  • True, there IS an issue. We believe that the hosting provider DNS blocks requests from our server's IP if there have been to many in a short period of time. But that's just what we have to deal with, and handling that stuff with a hotline - which we keep trying - can be arduous. So we are looking for workarounds that are relatively reliable. This is real, not ideal, world stuff and, being developers, not sysadmins, we are certainly not happy about needing to dig into this. So please bear with us. – Olaf Nov 16 '11 at 10:49

The 4 ip addresses you are seeing using nslookup could just be gateway servers for the network using round robin dns for fail over / load balancing.

These gateways will relay to different "back ends", the only way to really be sure if this is occurring is to send test emails to yourself and inspect the email headers (unless they do a good job of purging internal ones), and see the different servers being use to send the emails.

  • Thanks, understood, so far. We'll run the test. Yet the question remains: how is SMTP working in that regard, compared to HTTP? Are there names in the headers somewhere? – Olaf Nov 16 '11 at 10:40

The target server name is not used in the SMTP request. There is no equivalent of the HTTP Host: header.

If you want to use an IP address instead of a DNS name, I'd recommend that you talk to the email service provider to verify which IP address they'd prefer you to use. (And, for $DEITY's sake, don't hard code the IP address - use a config file or put it in /etc/hosts, and verify it again before the next run!)

Another way of avoiding multiple hits on your ISP's DNS server would be to set up a local DNS resolver, instead of using your ISP's resolvers.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.