如何使用Gmail api获取收件箱列表并在asp.net中发送邮件?

问题描述:

大家好,

我的问题如下:

1)如何授权在asp.net中使用Gmail API进行帐号管理?

2)如何使用Gmail api获取收件箱列表并在asp.net中发送邮件?



请提供任何相关的示例代码。



提前谢谢。

hello everyon,
My questions are as follows:
1)How to authorized use Gmail API to account in asp.net?
2)How to use Gmail api get Inbox lists and sent mail in asp.net?

Please provide any relevant sample code.

Thanks in advance.

遗憾的是,没有正式的ASP.NET文档或示例项目从电子邮件服务器下载电子邮件;例如Gmail或Outlook。他们刚刚创建了一个帮助程序类WebMail,用于通过任何SMTP服务器发送电子邮件;包括Gmail。



无论如何,您可以尝试使用此网页 [ ^ ](Google帮助),然后尝试创建WebClient并在从Gmail服务器下载流时传递这些设置。希望这能为你的项目做好准备。我也不知道我可能在这里为您分享的任何ASP.NET示例IMAP客户端。但是,由于ASP.NET运行在.NET上,您可能希望在后端使用这些库,并在ASP.NET中以HTML格式显示它们的响应。



http://stackoverflow.com/a/1524173/1762944 [ ^ ]



https://www.nuget.org/packages/S22.Imap/ [ ^ ]
Sadly there is no official ASP.NET document or a sample project for downloading the emails from the email server; such as Gmail or Outlook. They just created a helper class WebMail for sending the emails through any SMTP server; including Gmail.

Anyways, you can try using these settings from this web page[^] (Google Help) and then try creating a WebClient and pass these settings while downloading the streams from the Gmail servers. Hopefully that would do the job for your project. I am also unaware of any ASP.NET sample IMAP client that I might share here for you. But since ASP.NET runs over .NET, you might want to use these libraries in the backend and show their responses in the HTML format in ASP.NET.

http://stackoverflow.com/a/1524173/1762944[^]

https://www.nuget.org/packages/S22.Imap/[^]


IMAP只是IMAP。像这样的图书馆: C#中的IMAP和POP3客户端 [ ^ ](或其他你可能会找到)可以帮助你肯定。如果你有用户名和密码,你可以直接连接到gmail,因为它可以免费连接到它。

另一方面,如果您想为第三方提供此服务,则需要注意有关您自己的应用程序的严重安全注意事项。



您可以查看任何开源asp.net webmail应用程序的来源,了解它们是如何实现的。以下是一些:

http://www.afterlogic.org/webmail-lite-net [ ^ ]

http://anmar.eu.org/projects/sharpwebmail/ [ ^ ]
IMAP is just IMAP. Libraries like this: IMAP and POP3 Clients in C#[^] (or others you might find) can help you for sure. If you have the username and password, you can simply connect to gmail also as it is free to connect to it.
On the other hand if you wnat to provide this as a service for third parties, you need to take care about serious security considerations regarding your own application.

You can look at the source of any open source asp.net webmail application to see how they have implemented it. Here are some:
http://www.afterlogic.org/webmail-lite-net[^]
http://anmar.eu.org/projects/sharpwebmail/[^]