我有一个严重的问题...帮助我! [英] i'm having a serious problem... help me !!!

查看:81
本文介绍了我有一个严重的问题...帮助我!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是测试页,用于将邮件从我的域帐户发送到gmail帐户

this is test page to send mail from my domain account to gmail account

public partial class TestEmail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSendEmail_Click(object sender, EventArgs e)
    {
        MailMessage mail = new MailMessage();

        NetworkCredential cred = new NetworkCredential("example@hotel.allmyanmarbooking.com", "mydomainpassword"); //client's gmail and password

        mail.To.Add("ToUserAccount@gmail.com");
        mail.Subject = "Test Email"; //message subject

        mail.From = new MailAddress("example@hotel.allmyanmarbooking.com", "example@hotel.allmyanmarbooking.com");
        

        mail.IsBodyHtml = true;
        mail.Body = "trying to send to from domain email account"; //message body

        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.allmyanmarbooking.com";
        smtp.Port = 26;
        smtp.UseDefaultCredentials = false;
        smtp.EnableSsl = false;
        smtp.Credentials = cred;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

            smtp.Send(mail);       

        lblEmail.Text = "Send Successful..";
    }
}



当我单击发送按钮时,我看到了该错误



when i clicked the send button, i saw that error

No connection could be made because the target machine actively refused it 66.197.198.196:26
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 66.197.198.196:26

Source Error:

Line 37:         smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
Line 38: 
Line 39:             smtp.Send(mail);       
Line 40: 
Line 41:         lblEmail.Text = "Send Successful..";



我不知道该怎么解决..
我的域SMTP支持端口25& 26
我都试过了..但是我解决不了..

:)



i don''t know how to solve..
my domain smtp support port 25 & 26
i tried both of them.. but i couldn''t solve it..

:)

推荐答案

如果总是发生这种情况,则从字面上意味着这台机器存在,但没有服务在指定端口上侦听,或者有防火墙阻止了您.

如果偶尔发生-您使用了有时"这个词-并且重试成功,则可能是因为服务器有完整的积压.

您可以尝试以下代码
If this happens always, it literally means that the machine exists but that it has no services listening on the specified port, or there is a firewall stopping you.

If it happens occasionally - you used the word "sometimes" - and retrying succeeds, it is likely because the server has a full backlog.

You can try the below code
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(gMailAccount, password);



如果问题仍然存在,则可能是GMail服务器问题.



If the problem continues, then it would be GMail server issue.


您好,

如果您通过gmail帐户发送邮件,则使用启用SSL的连接.

这是链接以获取Gmail设置信息.

此问题通常仅是设置问题.

希望这能解决您的问题.

谢谢
-Amit.
Hi,

if you are sending through gmail account then use SSL enabled connection.

Here is the link for the gmail setting information.

this problem is normally setting problem only.

hope this will resolve your issue.

Thanks
-Amit.


目标计算机主动拒绝它",表示该端口上没有服务列表.可能有多种原因.
smtp服务器无法运行.
两者之间更可能存在防火墙,该防火墙不允许您的系统使用端口26与66.197.198.196进行通信.

另一个问题可能是流量路由错误.

Piet
''target machine actively refused it'' means that there is no service listing at that port. There can be multiple reasons for it.
The smtp server can not be running.
More likely there is a firewall in between that does not allow communication from you''re system to 66.197.198.196 using port 26.

Another problem could be that the traffic is routed wrongly.

Piet


这篇关于我有一个严重的问题...帮助我!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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