Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Email using IP Address instead of Domain Name

Tags:

email

ip

dns

I am trying to avoid running through DNS servers to get an email message to an address on one of my hosted virtual accounts.

I know I can surround the IP address with square brackets but how do I designate the mailbox username for the (virtual) hosted account on the server?

In other words,

  • I have multiple domains hosted on a virtual server -- all sharing the same IP address
  • obviously, [email protected] works fine
  • but how do I send to user@[123.456.78.90]

Is what I want to do, possible?

Thanks.

like image 547
H. Ferrence Avatar asked May 26 '11 13:05

H. Ferrence


People also ask

Can you send email from IP address?

The short answer is technically yes, but really no. The Simple Mail Transfer Protocol (SMTP) does allow an IP address to be used instead of a domain name under special circumstances when encapsulated in brackets, such as our previous example of john. smith@[123.123.

Can you use IP instead of domain name?

It depends on the web server configuration. You can have a dedicated IP address and still not respond to the IP without the host and you can also have a shared ip address and have the IP address point to one of the websites on the server.

Why do we use IP addresses instead of names?

Just as a street address determines where a letter should be delivered, an IP address identifies computers on the Internet. Network devices use IP addresses to communicate with each other. The Internet uses DNS (Domain Name System) to enable people to use words instead of numbers for Internet addresses.

How do I use an IP address instead of a URL?

Type the string “http://” followed by the IP address and then a forward slash. For example, type “http:// 209.191. 122.70/” (without the quotes).


2 Answers

A virtual host needs a domain name in order to figure out what to do. You want to send it to an IP address instead of a domain name. Thus it is not going to work through normal methods. You might be able to specify a "default" domain if none match Otherwise, your only hope is to manually forge email. By this, I mean:

telnet 123.456.78.9 25
HELO myhostname.mydomain
MAIL From: <myemail@mydomain>
RCPT To: <[email protected]>
DATA
From: myemail@mydomain
To: [email protected]
Subject: Testing

This is a test
.
QUIT
like image 142
Seth Robertson Avatar answered Oct 16 '22 23:10

Seth Robertson


What you want to do is possible, and even secure when using Cjdns IPs. Some clients (e.g. mutt) are "broken" and choke on raw ips as domain. (While technically broken, it is an uncommon use case - mutt is a good client.)

You'll need to tell your MTA to accept the raw ip. E.g. on sendmail, add [123.456.78.9] to /etc/mail/local-host-names

You'll also have to turn on accept_unresolvable_domains as sendmail doesn't seem to regard already resolved domains as "resolvable". (Other MTAs may require different tweaks.)

I use thunderbird to send to raw ips, and it works just fine. A friend uses claws-mail with no problems.

like image 40
Stuart Gathman Avatar answered Oct 17 '22 00:10

Stuart Gathman