月別アーカイブ: 2014年7月




telnet接続を利用し、コマンドラインでメール送信をする手順




投稿日:

よく忘れるのでメモしておきます。

[html]
# telnet localhost 25 # telnet 接続先ホスト名 ポート番号
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 xxxxxx.net ESMTP Postfix

# ehlo mail.xxxxxx.net ## ehlo ホスト名 とします。 
250-xxxxxx.net
250-PIPELINING
250-SIZE 40960000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

# mail from:<xxxxxx@gmail.com> # 送信元の指定 (エンベローブfrom)
250 2.1.0 Ok

# rcpt to:<xxxxxx@xxxxx.com> # 送信先の指定 (エンベローブto)
250 2.1.5 Ok

# DATA # DATAと打つ。
354 End data with <CR><LF>.<CR><LF>

#From:xxxxxx@gmail.com
#To:xxxxxx@xxxxx.com
※必要な場合は、From と To も入れます。
  先ほどとの違いは、本文に入れるこちらは、ヘッダーfrom ヘッダーto と言います。

# subject:mail test
# this is test mail from xxxxxx
# . # 最後にカンマを打って終了の合図

250 2.0.0 Ok: queued as 4A9AE20C6C

# quit
221 2.0.0 Bye
Connection closed by foreign host.
[/html]

終了