电子邮件发送失败的asp.net [英] email sending failed asp.net

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

问题描述

每当我从gmail帐户发送邮件时,都会毫无例外地发送罚款。

但是当我尝试使用一些abc@daomin.com时失败了。



Whenever i am sending mail from gmail account its sending fine without any exception.
But when i tried it using some abc@daomin.com its failure.

MailMessage msg = new MailMessage();
            msg.From = new MailAddress(emailid);
            msg.To.Add(emailAddress);
            msg.Subject = "something";
            msg.Body = messageBody;
            SmtpClient sc = new SmtpClient("smtp.domainname.co.in");     
            
            sc.Credentials = new NetworkCredential(emailid, password);
            sc.EnableSsl = true;
            sc.Send(msg);





此代码无效。

我也是通过配置Web配置尝试。



This code is not working .
I also tried by configuring web config.

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="customersupport@deals4sure.co.in">
        
        <network defaultCredentials="false" host="mail.deals4sure.co.in" enableSsl="true" userName="abcd@daomainname.co.in" password="*******" port="587"/>
      </smtp>
    </mailSettings>
  </system.net>





但也不工作

请建议



But also its not working
Please suggest something

推荐答案

尝试以下内容:



Try the following:

private void SendEmail(string from, string to, string subject, string message)
    {
        using (var email = new System.Net.Mail.MailMessage())
        {
            email.From = new System.Net.Mail.MailAddress(from);
            email.To.Add(to);

            email.Subject = subject;
            email.Body = message;

            var smtp = new System.Net.Mail.SmtpClient("IP ADDRESS HERE");
            smtp.Send(email);
        }
    }





希望它有所帮助,欢呼。



Hope it helps, cheers.


通常,如果你有一个帐户,大多数邮件服务提供商只允许你使用他们的邮件服务器。



因此,无论你使用哪个域,它都会引发问题?... 。

abc@somedomain.com ....



您是否拥有somedomain.com的帐户或会员资格(无论名称是什么域名是)



你使用他们给你的邮件服务器设置吗?
Usually most mail service providers only allow you to use their mail servers if you have an account with them.

So it begs the question whatever domain your using?....
abc@somedomain.com....

Do you have an account or membership with somedomain.com (whatever the name of the domain is)

and are you using the mailserver settings they gave you?


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

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