Sending Email using IP Address instead of Domain Name

人走茶凉 提交于 2019-12-21 06:58:07

问题


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, user@domain.com works fine
  • but how do I send to user@[123.456.78.90]

Is what I want to do, possible?

Thanks.


回答1:


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: <user@domain.com>
DATA
From: myemail@mydomain
To: user@domain.com
Subject: Testing

This is a test
.
QUIT



回答2:


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.



来源:https://stackoverflow.com/questions/6139032/sending-email-using-ip-address-instead-of-domain-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!