语法错误,命令无法识别。服务器响应是'' [英] Syntax error, command unrecognized. The server response was ''

查看:1997
本文介绍了语法错误,命令无法识别。服务器响应是''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前为止,我已经看过3或4个问题,他们还没有帮到。



我在客户机上设置了SmarterMail 14.x 。我非常了解设置邮件服务器(我不知道他为什么认为我这样做),但是我已经安装了它,一个域名指向MX记录,端口打开(9998),我可以发送电子邮件从网页界面就可以了。



但是,我无法从Sql或C#发送电子邮件。我创建了一个快速而肮脏的应用程序,以允许我进入服务器,端口,凭据和/ /从每次得到这个响应:


[内部异常]
无法连接到远程服务器



[详细]
System.Net.Mail.SmtpException:失败发送邮件。 --->> System.Net.WebException:无法连接到远程服务器--->> System.Net.Sockets.SocketException:由于>目标机器主动拒绝,不能建立连接204.12.49.188:25


我尝试过多次登录。我也确认SMTP已打开,IMAP / POP3已关闭。我会发布它的图像,但不幸的是我还不能。



要发送的代码在下面,它的简单:

  SmtpClient client = new SmtpClient(ServerTextBox.Text,Convert.ToInt32(PortTextBox.Text)); 
NetworkCredential login = new NetworkCredential(UsernameTextBox.Text,PasswordTextBox.Text);
client.Credentials = login;

MailMessage message = new MailMessage(FromTextBox.Text,ToTextBox.Text,Wine and Spirits Jobs Alerts,以下是本周的工作提醒:目前没有工作警报);

client.SendCompleted + = HandleSendCompleted;
client.SendAsync(message,null);

我也在本地在VPS和我的机器上尝试过。我已经打开和关闭防火墙,我有一个特定的规则,允许9998的流量(您可以远程登录到Web界面),所以这不是一个可以联系的问题。 >

我失去了做什么。如果有人可以帮助?



编辑:很明显,我使用错误的端口 - 9998而不是25.使用端口25现在告诉我超时或者是积极拒绝防火墙具有允许所有流量的端口25的特定规则,因此不应该停止。



编辑2:我已经重新创建了MX记录并确保它指向正确的IP地址。我还在Smartermail中重新创建了域,并确保SMTP已打开,需要身份验证,SSL不存在,POP和IMAP已关闭,我的登录信息正确无误。我也试过打开和关闭防火墙。没有骰子。

解决方案

我终于解决了这个问题。



与防火墙或MX记录无关,或使用/不使用IP地址以及与端口25确实分配给SMTP和SMTP确实已打开的事实有关,因此域本身的IP地址不是分配给SMTP配置,所以SmarterMail实际上并没有监控端口。



问题解决 - 电子邮件发送。好玩的东西!感谢大家的回应!


I've looked at 3 or 4 questions here so far and they haven't helped yet.

I have set up SmarterMail 14.x on a client's machine. I know very little about setting up mail servers (I don't know why he thinks I do) but I have it installed, a domain set up pointing to the MX record, the port open (9998) and I am able to send email just fine from the web interface.

However, I can't send email from Sql or from C#. I created a quick and dirty app to allow me to enter the server, port, credentials, and to/from and I get this response every time:

[Inner Exception] Unable to connect to the remote server

[Details] System.Net.Mail.SmtpException: Failure sending mail. ---> > System.Net.WebException: Unable to connect to the remote server ---> > System.Net.Sockets.SocketException: No connection could be made because the > target machine actively refused it 204.12.49.188:25

I've tried multiple logins. I've also confirmed that SMTP is turned on and IMAP/POP3 is turned off. I'd post images of it but unfortunately I can't yet.

The code to send is below and it is about as simple as it gets:

SmtpClient client = new SmtpClient(ServerTextBox.Text, Convert.ToInt32(PortTextBox.Text));
NetworkCredential login = new NetworkCredential(UsernameTextBox.Text, PasswordTextBox.Text);
client.Credentials = login;

MailMessage message = new MailMessage(FromTextBox.Text, ToTextBox.Text, "Wine and Spirits Jobs Alerts", "Below are this week's job alerts: There are no job alerts at this time");

client.SendCompleted += HandleSendCompleted;
client.SendAsync(message, null);

I've also tried it locally on their VPS and on my machine. I've turned on and off the firewall and I've got a specific rule allowing outgoing traffic on 9998 (and you can log into the web interface remotely) so this isn't a matter of being able to contact it.

I'm at a loss of what to do. If someone can help??

EDIT: It's clear I was using the wrong port - 9998 instead of 25. Using port 25 now tells me either time out or that it was actively refused. The firewall does have specific rules for port 25 that allow all traffic, so it shouldn't be stopped.

EDIT 2: I've re-created the MX record on the domain and ensured it is pointing to the correct IP address. I've also re-created the domain in Smartermail and made sure SMTP is turned on, authentication is required, SSL is not, POP and IMAP are turned off, and that my login is correct. I've also tried turning on and off the firewall. No dice.

解决方案

I finally solved the issue.

It had nothing to do with firewalls or the MX record or using/not using an IP address and everything to do with the fact that while port 25 was indeed assigned to SMTP and SMTP was indeed turned on, the IP address of the domain itself was NOT assigned to the SMTP configuration so SmarterMail wasn't actually monitoring the port.

Problem solved - email sends. Fun stuff! Thank you for everyone's responses!

这篇关于语法错误,命令无法识别。服务器响应是''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆