C#.net电子邮件处理 [英] C# .net EMail processing

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

问题描述

C#.net:如何创建一个使用密码登录到电子邮件ID的应用程序,该应用程序显示收件箱,并且可以通过该应用程序编写邮件.

C# .net: How to create a application that logins into an email ID with password displays inbox and can compose mail through the application

推荐答案

这里是一个示例让Gmail发送邮件:
Here is an example for Gmail to send a mail:
using System.Net.Mail;
using System.Net;

            var fromAddress = new MailAddress("from@gmail.com", "From Name");
            var toAddress = new MailAddress("to@yahoo.com", "To Name");
            const string fromPassword = "password";
            const string subject = "test";
            const string body = "Hey now!!";

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout = 20000
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }


您可能还需要使用一个API:
https://developers.google.com/google-apps/gmail/ [


There is also an API that you may want to use:
https://developers.google.com/google-apps/gmail/[^]

Sending the mail should be identical for most email providers. Displaying the inbox may be different for each, so you may want to search for an API depending on which provider you use.


仔细阅读这些文章
使用C#构建自己的邮件客户端 [ ^ ]
C#.NET中的POP3客户端 [使用.NET(C#)的Windows Email Client应用程序 [ ^ ]
go through these articles
Building your own Mail Client using C#[^]
A POP3 Client in C# .NET[^]
Windows Email Client application using .NET (C#)[^]


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

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