使用hostgator托管发送邮件的问题 [英] Problem with sending mail using hostgator hosting

查看:71
本文介绍了使用hostgator托管发送邮件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有从我的网站发送邮件的表格。该表单有3个文本框,名称,邮件,正文,因此用户可以向我发送邮件,其中包含有关我网站的一些问题。当我在localhost上测试页面时,这个表单工作得很好但在服务器上给我一些错误。错误是System.Net.Sockets.SocketException:尝试对无法访问的网络执行套接字操作[2607:f8b0:4003:c02 :: 6d]:25。我不知道我的错误在哪里。这是我发送邮件的代码:



Hi,
i have form for sending mail from my website. The form have 3 textboxes, Name, Mail, Body, so users can send me mail with some questions about my site. when i test the page on localhost this form works perfectly but on the server trow me some error. The error is "System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network [2607:f8b0:4003:c02::6d]:25". i dont know where is my mistake. here is my code for sending mail:

MailMessage mail = new MailMessage();
        mail.To.Add("contact@emall.mk");
        mail.From = new MailAddress(txtEmail.Text);
        mail.Subject = "Порака од корисник  ";

        string Body = txtBody.Text;
        mail.Body = Body;

        mail.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
        smtp.Credentials = new System.Net.NetworkCredential
        ("contact.emallmk@gmail.com", "898261898");
        //Or your Smtp Email ID and Password
        smtp.EnableSsl = true;
        smtp.Send(mail);





希望有人会帮助我......



hope some one will help me...

推荐答案

即使我遇到同样的问题也可以帮助。
can someone help even i face same problem .


这对于询问HostGator客户支持是一个很好的问题,但他们可能不会冒昧如果你使用smtp.gmail.com,请回答你。通常(如果不总是),Web托管服务提供商提供对其自己的SMTP或其他服务的访问,并为用户提供单独的帐户(通常是无限数量的帐户或受到足够数量的帐户的限制)。他们对自己的服务功能负责,如果与他们的服务相关,他们会尽量回答您的问题。因此,我建议您使用您的Web服务提供商,HostGator或任何其他服务。



-SA
This would be a good question to ask HostGator customer support, but they may not take the liberty to answer you if you are using "smtp.gmail.com". Usually (if not always), Web hosting provider provide access to their own SMTP or other service and provide the users with separate accounts (pretty often unlimited number of then or limited by some sufficient number of accounts). They take responsibility for their service functionality and mush try to answer you questions if they are relevant to their service. So, I would advise to use the services of your Web service provider, HostGator or any other one.

—SA


最后我解决它是完美的代码



Finaly i solve it here is the code it works perfectly

MailMessage EmailMsg = new MailMessage();
                                EmailMsg.From = new MailAddress("fromMaill@emall.mk", "Системска порака :: еMall.mk");
                                EmailMsg.To.Add(new MailAddress(toMail@emall.mk, "Заборавена лозинка - Безбедносен код"));
                                EmailMsg.Subject = "Заборавена лозинка - Безбедносен код";
                                EmailMsg.Body = BODY;
                                EmailMsg.IsBodyHtml = true;
                                EmailMsg.Priority = MailPriority.Normal;

                                SmtpClient MailClient = new SmtpClient("mail.yourhostdomail.com");
                                MailClient.Credentials = new System.Net.NetworkCredential("emailaddress", "Passworofmail");
                                MailClient.Send(EmailMsg);


这篇关于使用hostgator托管发送邮件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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