question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow address.parse() to reject addresses with local hostnames

See original GitHub issue

address.parse() currently accepts addresses with a single-part domain as used for a local mail host, e.g. bleah@example. I am currently working on a use case where we would only want to send to Internet addresses, like bleah@example.com or bleah@foo.example.com. It would be useful to have an option to reject addresses with single-part domains.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
horkhecommented, Jun 8, 2018

It seems to be too use case specific to be included as a parser option. I can think of many similar specific use cases e.g.: do not allow domains of 3rd, 4th, Xth level; do not allow domains from specific top level domains; do not allow domains from a certain geo region… All that seems like a higher level of abstraction that lays out of the scope of the email address syntax parsing.

In your case the solution is as simple as:

addr = parse('bleah@example')
if addr and '.' in add.hostname:
    // bingo
else:
    // invalid address or local domain 

So I think it is out of the scope of Flanker and should not be implemented. @b0d0nne11 what do you think?

0reactions
grvsmthcommented, Jun 8, 2018

We don’t really want to go to the trouble of calling validate_address() when all we want is to check the form of the address, but thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I resolve a hostname to an IP address in a Bash script?
The correct solution is to use getent ahosts <host> to try both IPv6 and IPv4 if needed. Worth mentioning: host, dig and nslookup...
Read more >
How to configure hostname resolution to use a custom DNS ...
Host name -to-IP address resolution is accomplished through the use of a combination of local machine configuration information and network ...
Read more >
Postfix Configuration Parameters
When rejecting non-address information (such as the HELO command argument or the client hostname/address), the Postfix SMTP server will transform a sender ...
Read more >
8. Configuration Reference — BIND 9 9.18.8 documentation
Configuration file parsing and processing. database. Messages relating to the databases used internally by the name server to store zone and cache data....
Read more >
How To Configure BIND as a Private Network DNS Server on ...
In this tutorial, we will go over how to set up an internal DNS server, using the BIND name server software (BIND9) on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found