ASP.Net发送电子邮件 [英] ASP.Net sending Email

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

问题描述

我是新来的发送电子邮件的人.我已经尝试了许多教程课程,但是没有用.我认为这可能是我的IIS服务的原因. SMTP电子邮件中没有虚拟目录,但我已经安装了IIS.当我编写用于发送电子邮件的代码时,它出现了一些错误和警告

I am new for sending email. I have tried many tutorial Lessons, but i did not work. I think it may cause of my IIS service. There is no Virtual Directory in SMTP E-Mail but i have installed IIS already. When I wrote code for sending Email it had some error and warning

// NameSpace
using System.Web.Mail;


            MailMessage mymail = new MailMessage();
            mymail.To = txtTo.Text.ToString();
            mymail.From = "[DELETED]@hotmail.com";
            mymail.Subject = txtSubject.Text.ToString();
            mymail.Body = txtMessage.Text.ToString();

            SmtpMail.SmtpServer = "localhost";
         
            SmtpMail.Send(mymail);



在那里,SmtpMail被突出显示为警告,警告显示为"System.Web.Mail.SmtpMail已过时.建议的替代方法是system.Net.Mail.SmtpClient http://go.microsoft.com/fwlink/?linkid = 14202"

我仍在笔记本电脑上测试我的项目,尚未注册域名.我只想在计算机上测试我的项目(是否可以不申请域名?)请eeeeee帮我.......非常感谢



我真的需要你的帮助,


[edit]电子邮件已删除-OriginalGriff [/edit]



there SmtpMail was highlighted as warning and the warning show "System.Web.Mail.SmtpMail is obsolete. The recommended alternative is system.Net.Mail.SmtpClient http://go.microsoft.com/fwlink/?linkid = 14202"

I still test my project at my laptop,havent registered for domain name yet. I just want to test my project on my computer (Is it possible not to apply for the domain name?) Pleaseeeee help me ....... Thanks so much



I really need your help,


[edit]Email removed - OriginalGriff[/edit]

推荐答案

在这里看看:
Have a look here: Sending an Email in C# with or without attachments: generic routine.[^] - it''s a generic routine that works fine for me!


您好,
请检查此
使用ASP.NET发送邮件/联系表和C# [ ^ ]
Hello,
Please check this Send Mail / Contact Form using ASP.NET and C#[^]



检查此
在asp.net中发送电子邮件 [
Hi,
Check this
sending emails in asp.net[^]
Best Regards
M.Mitwalli


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

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