在Asp.net 4.0中发送和接收电子邮件 [英] Sending and Receiving Emails in Asp.net 4.0

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

问题描述

 MailMessage msg = new MailMessage(); 
msg.From = new MailAddress(txtFrom.Text);
msg.To.Add(txtTo.Text);
msg.To.Add(txtTo.Text);
msg.Subject = txtSubject.Text;
msg.Body = txtBody.Text;
msg.IsBodyHtml = true;
msg.Priority = MailPriority.High;

SmtpClient client = new SmtpClient(smtp.gmail.com,587);
client.EnableSsl = true;

NetworkCredential credentials = new NetworkCredential(+ txtFrom.Text +,+ txtSMTPServer.Text +);

client.Credentials = credentials;


client.Send(msg);







这是发送电子邮件的代码。我想知道如何在我的应用程序的收件箱中接收电子邮件。如何从其他邮件ID(hotmail,yahoo等)发送电子邮件

解决方案

< blockquote>此链接将帮助您

阅读E邮件来自ASP.NET [ ^ ]


在ASP.NET中读取Gmail收件箱消息 [ ^ ]


用于发送邮件...

使用ASP.NET和C#发送邮件/联系表单 [ ^ ]

谢谢你。


MailMessage msg = new MailMessage();
            msg.From = new MailAddress(txtFrom.Text);
            msg.To.Add(txtTo.Text);
            msg.To.Add(txtTo.Text);
            msg.Subject = txtSubject.Text;
            msg.Body = txtBody.Text;
            msg.IsBodyHtml = true;
            msg.Priority = MailPriority.High;
           
            SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
            client.EnableSsl = true;
           
            NetworkCredential credentials = new NetworkCredential(""+txtFrom.Text+"", ""+txtSMTPServer.Text+"");
           
            client.Credentials = credentials;
          
               
                client.Send(msg);




This was the code for sending email.I want to Know how to receive email in my application's inbox .How email is sending from other mail id's(hotmail,yahoo etc)

解决方案

This link will help you
Read E Mails from ASP.NET[^]


Read Gmail Inbox Message in ASP.NET[^]


For sending mail...
Send Mail / Contact Form using ASP.NET and C#[^]
thank u.


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

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