如何检查服务器内部配置的虚拟SMTP服务器使用inetmgr6是在c#中启动还是停止 [英] How to check virtual SMTP server configured inside server in Using inetmgr6 is start or stop in c#

查看:136
本文介绍了如何检查服务器内部配置的虚拟SMTP服务器使用inetmgr6是在c#中启动还是停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我在服务器内部配置了虚拟SMTP服务器使用inetmgr6和电子邮件发送代码如下: -



public static Boolean SendEmailUsingGmail(一些参数)

{

SmtpClient smtp = new SmtpClient();

尝试

{

smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;



smtp.Send(message);



返回true;



}

catch(Exception ex)

{

smtp = null;

返回false;

}

}



现在问题是smtp.send()方法总是在我的垂直服务器停止时返回true它不会进入catch块这就是为什么我无法维护失败的邮件记录或退回邮件逻辑。

如何ckeck那个v irtual SMTP服务器启动或停止使用c#代码。



亲爱的,您的帮助和逻辑将非常感激我。

plz提供一些解决方案...

hi dear all,

I have configured a virtual SMTP server inside server Using inetmgr6 and email sending code is like this :-

public static Boolean SendEmailUsingGmail(some parameters)
{
SmtpClient smtp = new SmtpClient();
try
{
smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;

smtp.Send(message);

return true;

}
catch (Exception ex)
{
smtp = null;
return false;
}
}

Now the problem is that smtp.send() method always returning true while my vertual server is stopped it's not going inside catch block that's why i'm unable to maintain failure mail logs or bounced mail logic.
how to ckeck that virtual SMTP server is start or stop using c# code.

Dear, Your help and logic will appreciate me a lot.
plz provide some solution...

推荐答案





smtp.send()返回true的原因是因为你配置smtp传递的方式。



你已经设置它使用 SmtpDeliveryMethod.PickupDirectoryFromIis

此设置不会直接使用您的本地smtp服务,而是发送电子邮件到mailroot文件夹位置。



希望它有所帮助。





由于邮件已成功写入mailroot文件夹,因此不会引发任何异常。



如果您将代码修改为使用网络传递方法,如果是,则可以将异常提升到您的asp.net代码e服务器不可用。

[/已编辑添加]
Hi,

The reason why smtp.send() is returning true is because of the way you have configured smtp delivery.

You have set it up to use SmtpDeliveryMethod.PickupDirectoryFromIis.
This setting will not directly use your local smtp service, but instead delivery email to the mailroot folder location.

Hope it helps.


As the message has been successfully written to the mailroot folder, no exception will be raised.

If you modifiy your code to use a network delivery method, then exception can be raised to your asp.net code if the server is not available.
[/Edited to add]


这篇关于如何检查服务器内部配置的虚拟SMTP服务器使用inetmgr6是在c#中启动还是停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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