summaryrefslogtreecommitdiffstats
path: root/SendGrid/SendGridMail/SendGrid.cs
diff options
context:
space:
mode:
authortmwilson <tom.wilson@alpinemetrics.com>2015-01-28 10:04:41 -0700
committertmwilson <tom.wilson@alpinemetrics.com>2015-01-28 10:04:41 -0700
commita4cccbd5e81d84e64c857e1d8f68335edcb482d7 (patch)
tree824fe266656efd5dc4be8aa27cee91b21490a080 /SendGrid/SendGridMail/SendGrid.cs
parent6354302c92e8994b44ae8fc89a992ad4ffca5b6d (diff)
downloadsendgrid-csharp-a4cccbd5e81d84e64c857e1d8f68335edcb482d7.zip
sendgrid-csharp-a4cccbd5e81d84e64c857e1d8f68335edcb482d7.tar.gz
sendgrid-csharp-a4cccbd5e81d84e64c857e1d8f68335edcb482d7.tar.bz2
adding ability to embed an image via a memory stream. I'm generating an image and then transferring it to memory stream right away. This prevents you from having to create a file if you already have a memory stream.
Diffstat (limited to 'SendGrid/SendGridMail/SendGrid.cs')
-rw-r--r--SendGrid/SendGridMail/SendGrid.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs
index 1533a46..9d43dc2 100644
--- a/SendGrid/SendGridMail/SendGrid.cs
+++ b/SendGrid/SendGridMail/SendGrid.cs
@@ -245,6 +245,16 @@ namespace SendGrid
StreamedAttachments[name] = ms;
}
+ public void EmbedStreamImage(Stream stream, String name)
+ {
+ var ms = new MemoryStream();
+ stream.CopyTo(ms);
+ ms.Seek(0, SeekOrigin.Begin);
+ StreamedAttachments[name] = ms;
+
+ _contentImages[name] = name;
+ }
+
public void AddAttachment(String filePath)
{
_attachments.Add(filePath);