我可以从本地计算机发送带有附件的电子邮件,但无法弄清楚如何发送Google云端硬盘中文件的附件。
如果设置了共享权限,可以在下面的代码中使用简单路径发送文件吗?如果是这样,我该怎么走?
如何在不共享权限的情况下发送文件?
这是我的MailGun发送代码...
public static void Send()
{
RestClient client = new RestClient();
client.BaseUrl = new Uri("https://api.mailgun.net/v3");
client.Authenticator = new HttpBasicAuthenticator("api", "abc123");
RestRequest request = new RestRequest();
request.AddParameter("domain", "mail.dealopo.ly", ParameterType.UrlSegment);
request.Resource = "{domain}/messages";
request.AddParameter("from", "Name <test@sandboxcabc123.mailgun.org>");
request.AddParameter("to", "myemail@msn.com");
request.AddParameter("subject", "Hello");
request.AddParameter("text", "Testing some Mailgun awesomness!");
request.AddParameter("html", "<html>Inline image here: <img src=\"cid:Capture.jpg\"></html>");
request.AddFile("inline", Path.Combine(@"C:\Users\Jeremy\Desktop", "Capture.jpg"));
request.AddFile("attachment", Path.Combine(@"C:\Users\Jeremy\Desktop", "Local File.pdf"));
request.AddFile("attachment", Path.Combine(@"WHAT PATH DO I USE??", "Google Drive File.pdf"));
request.Method = Method.POST;
var response = client.Execute(request);
}