How to send email with an attachment using Windows Phone 7 API?

☆樱花仙子☆ 提交于 2019-11-27 02:49:07

问题


My WP7 application requirement is to send the email with an attachment and use device default SMTP settings.

I have tried EmailComposeTask class but it doesn't have any member for attachment.

The other idea, i am thinking is to upload the file on server and then send the email from that server.

What you think if there is no way to send the email with an attachment using WP7 API?


回答1:


Your observation is correct, at this point in time EmailComposeTask doesn't support attachments and this is the only facility to send email programatically from the device at the moment.

As you note, you can communicate with a server which can perform this task on behalf of your app.




回答2:


I found a wp7 and wp8 library that does it: http://www.windowsphonegeek.com/marketplace/components/livemailmessage




回答3:


Try to create web service to send mail in your webserver. so, we can call the from your app to send mail. I hope upcoming version it will be possible!

Please check this URL for more details http://forums.silverlight.net/forums/p/209808/493532.aspx




回答4:


I've found this article, but I did not make any test yet.

From the author:

EmailComposeTask won’t allow you to send attachments, but this doesn’t mean that you cannot send files through it. .NET Framework has these two amazing methods: Convert.ToBase64String and Convert.FromBase64String. The first will allow the developer to convert a byte array (byte[]) to a Base64-encoded string, the other one will do the same operation in reverse.

Reference: Pushing the Limits of the Windows Phone SDK and Sending Files via EmailComposeTask



来源:https://stackoverflow.com/questions/4011267/how-to-send-email-with-an-attachment-using-windows-phone-7-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!