sendmail发送邮件 - linux发送邮件




如何检查smtp是否从命令行工作(Linux) (3)

Telnet到你的smtp服务器就好

telnet smtp.mydomain.com 25

句法 :

telnet {smtp_domain_name} {port_number}

并复制并粘贴下面

helo your_domain.com
mail from:<[email protected]_domain.com>
rcpt to:<[email protected]_domain.com>
data
From: [email protected]_domain.com
Subject: test mail from command line

this is test number 1
sent from linux box
.

注意:不要忘记“。” 在代表消息结束的末尾

我在网络上发现了这一点,并将其添加到堆栈溢出中,因为许多事情最终都在这里。

我有一个SMTP服务器,为这个问题的目的让我们打电话给它:smtp.mydomain.com。

我如何检查SMTP服务器是否在工作? 我可以从Linux命令行发送电子邮件吗?



[[email protected] tmp]# mail -v [email protected]
Subject: Test
Hello world
Cc:  <Ctrl+D>

[email protected] Connecting to [127.0.0.1] via relay...
220 piwik-dev.example.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 23 Aug 2012 10:49:40 -0400
>>> EHLO piwik-dev.example.com
250-piwik-dev.example.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> MAIL From:<[email protected]> SIZE=46
250 2.1.0 <[email protected]>... Sender ok
>>> RCPT To:<[email protected]>
>>> DATA
250 2.1.5 <[email protected]>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 q7NEneju002633 Message accepted for delivery
[email protected] Sent (q7NEneju002633 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 piwik-dev.example.com closing connection




smtp