有没有办法在Windows

有没有办法在Windows

本文介绍了有没有办法在Windows Phone中发送带附件的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

EmailComposeTask没有任何方式发送附件真的很令人沮丧。我用Google搜索并找到了MailMessage dll。我不知道它是否安全,因为用户会发送他的密码。现在我正在考虑建立自己的服务,从手机发送数据到服务,服务将使用smtp发送带附件的电子邮件。现在我想问,我是对的吗?我使用什么样的服务?

Its really frustating that EmailComposeTask doesn't have any way to send attachments. I googled this and found MailMessage dll. I don't know whether it is secure or not because user gonna send his password. Now I am thinking tot build my own service, send data from phone to service, and service will use smtp to send email with attachment. Now I want to ask, Am I right? What kind of service I use?

推荐答案

...

public <type> sendmail(params)
{

...

    using (var client = new SmtpClient("smtp.gmail.com", 587))
    {
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.UseDefaultCredentials = false;
        client.EnableSsl = true;
        client.Credentials = new NetworkCredential("{yourusername}", "{yourpassword}");

        MailMessage message = new MailMessage();

        using (MemoryStream stream = new MemoryStream(new byte[{size}]))
        {
    	    Attachment attachment = new Attachment(stream, "my attachment");
            message.Attachments.Add(attachment);
        }

        message.To.Add({"destinationemailaddress"});
        message.Subject = "{subject}";
        message.From = new MailAddress("youremailaddress");
        message.Body = "{body text}";

       client.Send(message);
    }
...

}

...



这篇关于有没有办法在Windows Phone中发送带附件的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:48