电子邮件发送失败在asp.net自己的域名 [英] Email sending fail in asp.net out own domain

查看:82
本文介绍了电子邮件发送失败在asp.net自己的域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

i使用下面的代码向我们的Clint发送一封确认电子邮件,但是有如下例外:System.Net.Mail.SmtpException未被用户代码处理Message =发送邮件失败。



这是我的代码ominfosoft是我的domaiin名字



 SmtpClient smtp =  new  SmtpClient(  smtp.ominfosoft.in ); 
MailMessage mail = new MailMessage();
mail.To.Add(TextBox2.Text);
mail.From = new MailAddress( info@ominfosoft.in);
mail.Subject = Re:感谢您的要求;
mail.Body = 这是一封自动发送的电子邮件请不要回复;
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential(
info @ ominfosoft。 in xxxxxxxx ) ;
smtp.EnableSsl = true;
smtp.Send(mail);

解决方案

您的代码与我使用的代码非常相似:发送带有或不带附件的C#中的电子邮件:通用例程。 [ ^ ] - 我能看到的唯一区别是我设置了主机,并且不改变我的端口麻木呃。检查您要针对电子邮件系统设置发送的端口号,并尝试将主机设置为适当的值。

从AppSettings开始加载,并且是

 <   add     key   =  SMTPHost    value   =  LocalHost  /  >  



 <   add     key   =  SMTPHost    value   =  smtp.MyHostingService.com < span class =code-keyword> /  >  

取决于我是在运行它还是发布。


hello
i have using below code to send a confirmation email to our Clint, but having an exception as below: System.Net.Mail.SmtpException was unhandled by user code Message=Failure sending mail.

here is my code ominfosoft is my on domaiin name

SmtpClient smtp = new SmtpClient("smtp.ominfosoft.in");
       MailMessage mail = new MailMessage();
       mail.To.Add(TextBox2.Text);
       mail.From = new MailAddress("info@ominfosoft.in");
       mail.Subject = "Re: Thank you for your request";
       mail.Body = "It is an automatic email please do not reply;
       smtp.Port = 587;
       smtp.Credentials = new System.Net.NetworkCredential("info@ominfosoft.in", "xxxxxxxx");
       smtp.EnableSsl = true;
       smtp.Send(mail);

解决方案

Your code is very similar to the code I use: Sending an Email in C# with or without attachments: generic routine.[^] - the only differences I can see are that I set the Host, and don't change my Port number. Check the port number you are trying to send against your email system setup, and try setting the host to an appropriate value.
Mine loads from AppSettings, and is either

<add key="SMTPHost" value="LocalHost"/>


Or

<add key="SMTPHost" value="smtp.MyHostingService.com"/>

depending on whether I'm running it development or release.


这篇关于电子邮件发送失败在asp.net自己的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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