本文介绍了使用C#在ASP.Net中发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//mail sending
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("[email protected]");
            mail.To.Add("[email protected]");

            //to send mail on textbox value use this code.
            mail.To.Add("[email protected]");
            mail.IsBodyHtml = true;

            mail.Subject = "ABC";

            mail.Body = "this is mail body";
            SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);

            smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "9876543210");
            smtp.EnableSsl = true;
            smtp.Send(mail);

            TxtFullName.Text = "";
            TxtEmailID.Text = "";
            TxtContactNo.Text = "";
            TxtFeedback.Text = "";

            LblMsg.Text = "Your Mail is Submited...";







i am used above code for Email sending, it is work well project are run as Local host....
but when project are run on Server, then mail are not send... it is display the error...

Error Is :-

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".







<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>





Thanx提前。



Thanx in advance.

推荐答案


这篇关于使用C#在ASP.Net中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 23:01