summaryrefslogtreecommitdiffstats
path: root/src/SendGrid/Helpers/Mail/MailHelper.cs
blob: f151c1f7b468faf21bbba0e01996c33b116b739b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Collections.Generic;

namespace SendGrid.Helpers.Mail
{

    public class MailHelper
    {
        public static SendGridMessage CreateSingleEmail(EmailAddress from,
                                                        EmailAddress to,
                                                        string subject,
                                                        string contentText,
                                                        string contentHtml)
        {
            var msg = new SendGridMessage()
            {
                From = from,
                Personalization = new List<Personalization>() {
                    new Personalization() {
                        Tos = new List<EmailAddress>() {
                            to
                        }
                    }
                },
                Subject = subject,
                Contents = new List<Content>() {
                    new PlainTextContent(contentText),
                    new HtmlContent(contentHtml)
                }
            };
            return msg;
        }
    }
}