diff options
author | Brandon West <brawest@gmail.com> | 2013-07-27 13:00:35 -0600 |
---|---|---|
committer | Brandon West <brawest@gmail.com> | 2013-07-29 09:28:31 -0600 |
commit | edc3e7612651cd309f16236abd0f38a5fe58e8c4 (patch) | |
tree | ff75a49323e327dd9262e7ad4d4f7826e4b1e1ad /SendGrid/SendGridMail/Transport/Web.cs | |
parent | 9257d2669284f01311421e1c16b09a2a43dde725 (diff) | |
download | sendgrid-csharp-edc3e7612651cd309f16236abd0f38a5fe58e8c4.zip sendgrid-csharp-edc3e7612651cd309f16236abd0f38a5fe58e8c4.tar.gz sendgrid-csharp-edc3e7612651cd309f16236abd0f38a5fe58e8c4.tar.bz2 |
cleanup example, fix attachments
Diffstat (limited to 'SendGrid/SendGridMail/Transport/Web.cs')
-rw-r--r-- | SendGrid/SendGridMail/Transport/Web.cs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs index b7c5507..2e32f47 100644 --- a/SendGrid/SendGridMail/Transport/Web.cs +++ b/SendGrid/SendGridMail/Transport/Web.cs @@ -13,7 +13,7 @@ namespace SendGridMail.Transport {
#region Properties
//TODO: Make this configurable
- public const String BaseUrl = "sendgrid-com-ddrst15a2d5q.runscope.net";//"sendgrid.com/api/";
+ public const String BaseUrl = "sendgrid.com/api/";
public const String Endpoint = "/api/mail.send";
public const String JsonFormat = "json";
public const String XmlFormat = "xml";
@@ -82,9 +82,11 @@ namespace SendGridMail.Transport fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
- FileName = "files[" + Path.GetFileName(file.Key) + "]"
+ Name = "files[" + Path.GetFileName(file.Key) + "]",
+ FileName = Path.GetFileName(file.Key)
};
+ fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
content.Add(fileContent);
}
@@ -93,12 +95,15 @@ namespace SendGridMail.Transport var name = file.Key;
var stream = file.Value;
var fileContent = new StreamContent(stream);
-
- fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
+
+ fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
- FileName = "files[" + name + "]"
+ Name = "files[" + Path.GetFileName(file.Key) + "]",
+ FileName = Path.GetFileName(file.Key)
};
- content.Add(fileContent);
+
+ fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/octet-stream");
+ content.Add(fileContent);
}
}
|