通过CMD控制台发送邮件

通过CMD控制台发送邮件

本文介绍了通过CMD控制台发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过Microsoft cmd控制台发送邮件。我尝试了很多方法,但没有成功。

Hi i want to send mail via microsoft cmd console. I tried many way, but i didnt succeed.

我尝试了这篇文章

sendmail "[email protected] bcc:[email protected]" Test Hello!

错误是:

'sendmail' is not recognized as an internal or external command operable program or batch file

此文章:

c:\>"c:\program files\microsoft office\office12\outlook.exe" /c ipm.note /m [email protected] /a "c:\logs\logfile.txt"

错误是:

the process can not access the file because it is being used by another proccess

,但是没有用。我不知道问题出在哪里或问题出在哪里。

but it didnt worked. i dont know where is the problem or what is the problem.

感谢您的建议。

推荐答案

方案:
您的域: mydomain.com
您希望发送到的域: theirdomain.com

1。确定要发送到的邮件服务器。
打开CMD提示
类型

1. Determine the mail server you're sending to. Open a CMD prompt Type

NSLOOKUP
 set q=mx
 theirdomain.com

响应:

Non-authoritative answer:
theirdomain.com MX preference = 50, mail exchanger = mail.theirdomain.com
Nslookup_big

编辑
确保键入 exit 终止NSLOOKUP。

EDITBe sure to type exit to terminate NSLOOKUP.

2。连接到他们的邮件服务器

SMTP通过端口25进行通信。我们现在将尝试使用TELNET连接到他们的邮件服务器 mail.theirdomain.com

SMTP communicates over port 25. We will now try to use TELNET to connect to their mail server "mail.theirdomain.com"

打开CMD提示

TELNET MAIL.THEIRDOMAIN.COM 25

您应该看到类似这样的内容响应:

You should see something like this as a response:

220 mx.google.com ESMTP 6si6253627yxg.6

请注意,不同的服务器会出现不同的问候,但是您应该得到一些东西。如果此时什么都没发生,那么可能有2个问题。端口25被防火墙阻止,或者它们的服务器没有响应。尝试使用其他域,如果可行,那么不是您。

Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you.

3。发送电子邮件

现在,使用简单的SMTP命令发送测试电子邮件。这非常重要,您不能使用Backspace键,它将在屏幕上运行但无法正确解释。您必须完美地键入以下命令。

Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly.

ehlo mydomain.com
mail from:<[email protected]>
rcpt to:<[email protected]>
data
This is a test, please do not respond
.
quit

那么,这一切意味着什么?
EHLO -向您介绍邮件服务器HELO也可以使用,但是EHLO告诉服务器使用扩展命令集(不是我们正在使用它)。

So, what does that all mean?EHLO - introduce yourself to the mail server HELO can also be used but EHLO tells the server to use the extended command set (not that we're using that).

邮件发件人-谁在发送电子邮件。确保将其放置为大于/小于括号,因为许多电子邮件服务器都需要此括号(Postini)。

MAIL FROM - who's sending the email. Make sure to place this is the greater than/less than brackets as many email servers will require this (Postini).

RCPT TO -谁您正在发送给。同样,您需要使用括号。有关如何测试中继邮件的信息,请参见步骤4。

RCPT TO - who you're sending it to. Again you need to use the brackets. See Step #4 on how to test relaying mail!

DATA -告诉SMTP服务器以下内容是您的电子邮件正文。请确保在最后按 Enter。

DATA - tells the SMTP server that what follows is the body of your email. Make sure to hit "Enter" at the end.

。 -仅一行上的句点就告诉SMTP服务器,您已经完成了数据部分,可以发送电子邮件了。

. - the period alone on the line tells the SMTP server you're all done with the data portion and it's clear to send the email.

quit-退出TELNET会话。

quit - exits the TELNET session.

4。测试SMTP中继
测试SMTP中继非常简单,只需对上述命令进行一些改动即可。见下文:

4. Test SMTP relayTesting SMTP relay is very easy, and simply requires a small change to the above commands. See below:

ehlo mydomain.com
mail from:<[email protected]>
rcpt to:<[email protected]>
data
This is a test, please do not respond
.
quit

看到区别了吗?在RCPT TO行上,我们正在发送到不受发送到SMTP服务器控制的域。 SMTP中继已关闭,您将立即收到错误消息。如果您可以继续发送电子邮件,则该服务器允许中继。

See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server.

这篇关于通过CMD控制台发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:09