No "To: " email id at the recipient side while using telnet/nc to send mail

Published: by

  • Categories:
[root@outbound postfix]# nc localhost 25
220 outbound.server.com ESMTP Postfix
helo server
250 outbound.server.com
mail from: 
250 2.1.0 Ok
rcpt to: 
250 2.1.5 Ok
data
354 End data with .
Subject: Test Mail

Body
.
250 2.0.0 Ok: queued as 0E703C400B8

In a typical session like above, the client will have no "To: " emailid but the mail is still received because the "To: " header which an email client uses to find the receiver is not a compulsory header & it's not used to route emails.

That header is added by the email client while sending the mail & the email client at the receiving side uses that to get the sender's mail. To solve that, just add a "to:[email protected]" after the data entry.

[root@outbound postfix]# nc localhost 25
220 outbound.server.com ESMTP Postfix
helo server
250 outbound.server.com
mail from: 
250 2.1.0 Ok
rcpt to: 
250 2.1.5 Ok
data
354 End data with .
to:[email protected]
Subject: Test Mail

Body
.
250 2.0.0 Ok: queued as 0E703C400B8

server.com Subject: Test Mail

Body
.
250 2.0.0 Ok: queued as 0E703C400B8