summaryrefslogtreecommitdiffstats
path: root/src/SendGrid/Helpers/Mail/Mail.cs
diff options
context:
space:
mode:
authorElmer Thomas <elmer@thinkingserious.com>2016-12-12 23:58:19 -0800
committerElmer Thomas <elmer@thinkingserious.com>2016-12-12 23:58:19 -0800
commit83a0891c8917d06031571015e24c1acf88ac4ae2 (patch)
tree7b7f015a1c4f8a587624ada56a0af7746ef0a882 /src/SendGrid/Helpers/Mail/Mail.cs
parentff603f56e723d3e49c453cfdfe8dcf05617b6b50 (diff)
downloadsendgrid-csharp-origin/single-email.zip
sendgrid-csharp-origin/single-email.tar.gz
sendgrid-csharp-origin/single-email.tar.bz2
Properties FTW, Cancellation Tokens, Reorganizeorigin/single-email
Based on feedback from @darrelmiller and @jkewley on issue #331 and @taspeotis on issue 317. See ExampleCore for working example.
Diffstat (limited to 'src/SendGrid/Helpers/Mail/Mail.cs')
-rw-r--r--src/SendGrid/Helpers/Mail/Mail.cs47
1 files changed, 0 insertions, 47 deletions
diff --git a/src/SendGrid/Helpers/Mail/Mail.cs b/src/SendGrid/Helpers/Mail/Mail.cs
deleted file mode 100644
index d9ad829..0000000
--- a/src/SendGrid/Helpers/Mail/Mail.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Newtonsoft.Json;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace SendGrid.Helpers.Mail
-{
-
- public class Mail
- {
- private Client _client;
-
- public Mail(Client client)
- {
- _client = client;
- }
-
- public async Task<Response> SendEmailAsync(SendGridMessage msg)
- {
- return await _client.RequestAsync(Client.Method.POST,
- msg.Get(),
- urlPath: "mail/send").ConfigureAwait(false);
- }
-
- public async Task<Response> SendSingleEmailAsync(MailAddress from,
- MailAddress to,
- string subject,
- string contentText,
- string contentHTML,
- SendGridMessage msg = null)
- {
- if(msg == null)
- {
- msg = new SendGridMessage();
- }
- msg.From = from;
- msg.Subject = subject;
- var text = new Content(MimeType.Text, contentText);
- msg.AddContent(text);
- var html = new Content(MimeType.HTML, contentHTML);
- msg.AddContent(html);
- var p = new Personalization();
- p.AddTo(to);
- msg.AddPersonalization(p);
- return await SendEmailAsync(msg).ConfigureAwait(false);
- }
- }
-}