Coder Social home page Coder Social logo

smtpapi-csharp's People

Contributors

0xdeafcafe avatar abdullaharshad avatar blitzerpl avatar brandonmwest avatar derekneuland avatar ely-alamillo avatar eshanholtz avatar gabrielgene avatar garethpaul avatar gimly avatar jennifermah avatar leonpw avatar louiswhite15 avatar luciajimenez avatar mptap avatar nathan78906 avatar nocategory avatar not-not-kevin avatar pushkyn avatar rakatyal avatar robertacosta avatar sanjaysingh avatar shucon avatar shwetha-manvinkurke avatar svcprodsec-sendgrid avatar thepriefy avatar thinkingserious avatar twilio-ci avatar twilio-dx avatar whitneyrosenberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smtpapi-csharp's Issues

Add a .codeclimate.yml file to this repo

It is possible to configure how CodeClimate looks at a repository.
These Docs explain how this is done. Please create an appropriate .codeclimate.yml for this repo. It should test the main language of the repo and run tests.

Require conformance to style standards

Issue Summary

In the CONTRIBUTING.md file there is a section on Style Guidelines & Naming Conventions. Please review and implement a check in Travis CI. If there are any style errors, either fix or create a rule to exclude the error.

Before writing any code, we suggest you review our CONTRIBUTING.md file and propose your solution for discussion here in the comments. Thank you!

Aceptance Criteria

  • TravisCI checks that the code conforms to our Style Guidelines & Naming Conventions as defined in our CONTRIBUTING.md file
  • tests pass locally, in Travis CI and using Docker

JSON values should be escaped

Since the SendGrid API requires UTF-8 values to be escaped in the JSON structures, this should be handled by Utils.cs. Possibly by using JSON.NET and proper serialization settings.

NetStandard support

Is Netstandard support planned? Would be nice to use the library on Unix/MacOS/Windows with .NET Core.

Thread safe

Is this library thread safe? Also, do you have an example on how the Async call would work on a multi-thread program?

Add unittest to check for specific repo files

This repo should have the following list of files included:

  • ./Docker or docker/Docker
  • ./docker-compose.yml or ./docker/docker-compose.yml
  • ./.env_sample
  • ./.gitignore
  • ./.travis.yml
  • ./.codeclimate.yml
  • ./CHANGELOG.md
  • ./CODE_OF_CONDUCT.md
  • ./CONTRIBUTING.md
  • ./.github/ISSUE_TEMPLATE
  • ./LICENSE.md
  • ./.github/PULL_REQUEST_TEMPLATE
  • ./README.md
  • ./TROUBLESHOOTING.md
  • ./USAGE.md
  • ./USE_CASES.md

This PR is only asking for tests of the existence of these files, if the files do not exist when you run the tests - do not worry about the tests not passing. We will identify this and create a new PR for the issue.
Thank you!

Create a Use Cases Directory

Due to the success we have seen from hacktoberfest, we are seeing more people create use cases. This is amazing!
We want to make sure that everyone can find them. Please help us to break up this file and make it easier to read and manage:

  • Create a Use Cases Directory
  • Put a README.md in this directory
  • Make a file in the new directory for each individual Use Case from USE_CASES.md, copy the content to this file
  • For each file you've created, link to it from the README you created
  • Organize the links in the README by type
  • Make sure the names of the files you created are related to the Use Case
    Thank you!

Implement auto-deploy to package manager

Issue Summary

When all tests on the master branch pass in Travis CI, we would like to auto-deploy the release to the package manager.

Before writing any code, we suggest you review our CONTRIBUTING.md file and propose your solution for discussion here in the comments. Thank you!

Aceptance Criteria

  • when Travis CI passes all tests on the master branch we auto-deploy to the package manager
  • the version is determined by the CHANGELOG.md

Add a USAGE.md file

Usage files are really nice when they exist in a repo, because it makes it really obvious where to look for information about how to use this tool. It can be frustrating when you expect this file to be there and it's not.
Please add a USAGE.md file, you can see an example of this
here

Please make sure you modify the file for this repo (hint: Most of this information should be in the README file)

Hacktoberfest: SendGrid Current Status

SendGrid DX team current status:

  • Wow
  • OMG
  • THANK YOU

Hacktoberfest 2017 has completely blown us away. We have had over 900 pull requests from over 300 contributors all in the last 30 days. That is more PRs than we normally get in 2 years!
We are actively working to review, comment, and/or merge as many PRs as we possibly can as quickly as we can.

We are currently working on “intaking” all the PRs that have come in, oldest first (we have about 400 remaining to go through). We are making sure that each PR we review is one we have a chance of merging - there have been a couple spammy items that came through. Due to the massive influx of requests so far, @thinkingserious and @mbernier have been working nights and weekends all month just to keep up! We’re not even mad, this is amazing!

Hey, that’s great for you - but what about my shirt!

If you have signed the CLA before 11/1, but haven’t had a PR merged yet, do not despair! We know we are behind on even just commenting on every PR to show you that we received it (something we typically do). If you submitted a mergeable (non-spam, actually adds value to the project) PR during October 2017, we will grant access to this page to redeem your shirt, sticker, and hacker pin. Next year, we will be sure to communicate this information sooner. We are sorry for any confusion we have caused. We appreciate those of you who have reached out to find out what’s going on!

What can I do to help move things along?

Have you signed the CLA yet?
We can only merge items from contributors who signed the CLA

Can you help another contributor?
If you can identify potential problems, add suggestions, or even leave a comment with your review of another PR (Looks good to me! Or I approve this change), that would help us review those PRs much faster, making it easier to get to your PR.

Do you even write tests, friend?
If you see a place where we could have a test to validate a piece of functionality, add it in. We know We know! It’s just another PR we have to review and merge. You’re right, it is! However, the more tests we have, the earlier our CI tool can catch issues, saving us a review as well as back and forth time.

@blitzerpl, @mptap, @nolakat, @pushkyn, @shucon, @thepriefy

Update .md files for SEO-ness

We received an awesome PR for #hacktoberfest on our ruby library
We would love to see the same thing on the README in this repo as well.
Please replace the "-" with "_" in README, CONTRIBUTING, USE_CASES, USAGE files.

Thanks and happy Hacktoberfest!!

header limitation to a maximum total line length of 1,000 characters

Looking at the SendGrid documentation, the header is limited to a maximum total line length of 1,000 characters.
https://sendgrid.com/docs/API_Reference/SMTP_API/using_the_smtp_api.html#-Requirements-and-Limitations

Using the following code:
var header = new Header();
var recipients = new List { "[email protected]", "[email protected]", "[email protected]" };
header.SetTo(recipients);

    var subs = new List<String> { "A", "B", "C" };
    header.AddSubstitution("%name%", subs);

    string x = header.JsonString();
    mail.Headers.Add("X-SMTPAPI", x);

the header looks like:
{"to" : ["[email protected]", "[email protected]", "[email protected]"],"sub" : {"%name%" : ["A", "B", "C"]}}

Sending email to multiple recipients (splited into 1'000 per message) will generate a very, very, very long header...
Should the header not be wrapped to keep the line length under 1'000 characters? By RFC 821 no line can be longer than 1,000.

Failure to do this can split the header on non-space boundaries, which will cause spaces to be inserted in the final resulting e-mail.

Sendgrid provide an example where, after generating a string deserialization of the JSON representation of the object, they break lines based on whitespaces using a regex.

How would you recommend to wrap the header before send the message to avoid failure?

Add/Update Badges on README

Similar to what was done on the SendGrid node README:

  • put the logo at the top of the list
  • Add License like so
  • make sure the other badges are available like so:
![SendGrid Logo](https://uiux.s3.amazonaws.com/2016-logos/email-logo%402x.png)

For the following, make sure the correct repo is linked!
For email notifications, you can change the "nodejs" to the language of this repo (e.g. java, python, ruby, php, csharp, go, etc)

[![BuildStatus](https://travis-ci.org/sendgrid/sendgrid-nodejs.svg?branch=master)](https://travis-ci.org/sendgrid/sendgrid-nodejs)
[![Email Notifications Badge](https://dx.sendgrid.com/badge/nodejs)](https://dx.sendgrid.com/newsletter/nodejs)
[![npm](https://img.shields.io/npm/l/express.svg)]()
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)
[![GitHub contributors](https://img.shields.io/github/contributors/sendgrid/sendgrid-nodejs.svg)](https://github.com/sendgrid/sendgrid-nodejs/graphs/contributors)

Thank you and happy #Hacktoberfest!!

Document new Git workflow in CHANGELOG.md

Issue Summary

We want to update our git workflow to function more like Gitflow. We need to update the CONTRIBUTING.md file and PULL_REQUEST_TEMPLATE to direct contributors to fork/branch off the development branch and to merge their PRs with the development branch. Once this issue is complete, we will be creating the development branch and making that branch the default. This is part of a larger strategy to execute releases for this SDK on a predictable cadence.

Acceptance Criteria

  • Update CONTRIBUTING.md documentation, explaining the process of forking and branching off the development branch and submitting PRs agains the development branch.
  • Update PULL_REQUEST_TEMPLATE with the same addition to the CONTRIBUTING.md documentation.

Invalid symbol path compiled into SendGrid.SmtpApi.dll

Hi there, I'm a novice when it comes to GitHub, NuGet and debug symbols so apologies if this is the wrong place to report this, but we recently added the SendGrid NuGet package and its required dependency SendGrid.SmtpApi to our C# project and have been having some real slowdowns when building and running our project.

After a bit of digging I found that Visual Studio seems to be trying to access a path we don't have here:
\psf\home\SendGrid\xsmtpapi\Smtpapi\Smtpapi\obj\Release\SendGrid.SmtpApi.pdb

Visual Studio is getting a network timeout before proceeding and we're waiting for this to happen every time we run the project. This path seems to have been compiled into the assembly.

I managed to work around this changing Visual Studio options to exclude this module from symbol loading, but I thought it would be worthwhile for this to be adjusted in an upcoming release in case this causes issue for other developers.

Cheers,

Michael

Output of dumbin /headers below:

Microsoft (R) COFF/PE Dumper Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.

Dump of file SendGrid.SmtpApi.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
14C machine (x86)
3 number of sections
537D236D time date stamp Thu May 22 10:06:37 2014
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
2102 characteristics
Executable
32 bit word machine
DLL

OPTIONAL HEADER VALUES
10B magic # (PE32)
11.00 linker version
1E00 size of code
600 size of initialized data
0 size of uninitialized data
3D6E entry point (10003D6E)
2000 base of code
4000 base of data
10000000 image base (10000000 to 10007FFF)
2000 section alignment
200 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
8000 size of image
200 size of headers
FA1E checksum
3 subsystem (Windows CUI)
8540 DLL characteristics
Dynamic base
NX compatible
No structured exception handler
Terminal Server Aware
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
0 [ 0] RVA [size] of Export Directory
3D14 [ 57] RVA [size] of Import Directory
4000 [ 348] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
6000 [ C] RVA [size] of Base Relocation Directory
3BDC [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
0 [ 0] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
2000 [ 8] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
2008 [ 48] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory

SECTION HEADER #1
.text name
1D74 virtual size
2000 virtual address (10002000 to 10003D73)
1E00 size of raw data
200 file pointer to raw data (00000200 to 00001FFF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read

Debug Directories

    Time Type       Size      RVA  Pointer
-------- ------ -------- -------- --------
537D236D cv          11C 00003BF8     1DF8    Format: RSDS, {06873E5B-202B-457D-BE32-C6740EB9D8D1}, 2, \\psf\home\SendGrid\xsmtpapi\Smtpapi\Smtpapi\obj\Release\SendGrid.SmtpApi.pdb

SECTION HEADER #2
.rsrc name
348 virtual size
4000 virtual address (10004000 to 10004347)
400 size of raw data
2000 file pointer to raw data (00002000 to 000023FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
40000040 flags
Initialized Data
Read Only

SECTION HEADER #3
.reloc name
C virtual size
6000 virtual address (10006000 to 1000600B)
200 size of raw data
2400 file pointer to raw data (00002400 to 000025FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
42000040 flags
Initialized Data
Discardable
Read Only

Summary

    2000 .reloc
    2000 .rsrc
    2000 .text

Cannot specify more than one BCC recipient

You will have to forgive me if this has been added in a later version, but I am stuck using 1.1.3.0 as I need .net 4.0 support.

I can't see a way of adding more than one address to the BCC filter. I can quite happily add a single address like this:

var header = new SendGrid.SmtpApi.Header();
header.AddFilterSetting("bcc", new List<string>() { "enable" }, "1");
header.AddFilterSetting("bcc", new List<string>() { "email" }, "[email protected]");
Console.WriteLine(header.JsonString());

which will output:

{
    "filters": {
        "bcc": {
            "settings": {
                "enable": "1",
                "email": "[email protected]"
            }   
        }
    }
}

An array is required for multiple BCC recipients, like this:

{
    "filters": {
        "bcc": {
            "settings": {
                "enable": "1",
                "email": ["[email protected]", "[email protected]"]
            }   
        }
    }
}

But there is only one overload for the .AddFilterSetting() method, and anything I enter as the last argument is wrapped in quotes so I can't even pop the JSON array in myself.

If there is a way around this that someone could point to that would be awesome, otherwise it may be worth looking in to if you have time.

Thanks!

Error during mail merge: "A recipient must be specified"

When I try to do something similar to the mail merge type you have as an example I always get this error: "A recipient must be specified"

Am I supposed to also be using a "To" field in the MailMessage?

the docs specifically tell you NOT to include the TO field

When using the X-SMTPAPI to send to multiple recipients, you cannot use the standard SMTP protocols “TO” field to send to multiple recipients because doing so can generate duplicate messages to the addresses listed in both.

Also I just want to confirm that the smtpapi-csharp library will handle wrapping so I don't exceed the 1000 character line length limit.

My code looks very similar to this except I'm generating much much larger lists

var header = new Header();

// I'm sending out about 4K recipients
var recipients = new List<String> {"[email protected]", "[email protected]", "[email protected]"};
header.SetTo(recipients);

// I have 4 different subs instead of 1
var subs = new List<String> {"A","B","C"};
header.AddSubstitution("%name%", subs);

var mail = new MailMessage
{
    From = new MailAddress("[email protected]"),
    Subject = "Welcome",
    Body = "Hi there %name%"
};

// add the custom header that we built above
mail.Headers.Add("X-SMTPAPI", header.JsonString());

var client = new SmtpClient
{
    Port = 587,
    Host = "smpt.sendgrid.net",
    Timeout = 10000,
    DeliveryMethod = SmtpDeliveryMethod.Network,
    UseDefaultCredentials = false,
    Credentials = System.Net.NetworkCredential(username,password);
}
client.SendMailAsync(mail, null)
mail.Dispose()

(Mono) WARNING: The runtime version supported by this application is unavailable.

Issue Summary

mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./Smtpapi/HeaderTests/bin/Release/SendGrid.SmtpApi.HeaderTests.dll
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
NUnit-Console version 2.6.4.14350
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment - 
   OS Version: Unix 4.4.0.93
  CLR Version: 4.0.30319.42000 ( Mono 4.0 ( 5.4.0.201 (tarball Fri Oct 13 21:47:28 UTC 2017) ) )

Add a unittest to check the license.md file date range

The end year in the license file should be "this year" and this should be checked on every run of the tests. If the end year is no correct, fail the test.
example:

Copyright (c) 2012-2016 SendGrid, Inc.
It is 2017, so this should be:
Copyright (c) 2012-2017 SendGrid, Inc.
and the test should fail.
--done

Taking a long time to load

Taken from my StackOverflow question: http://stackoverflow.com/questions/29103061/sendgrid-smtp-api-dll-taking-a-long-time-to-load

I have an ASP.NET MVC app built with VS 2013.

I have included the SendGrid C# library via NUGET. All installed and works perfectly. The following versions are reported by Package Manager:

SendGrid 5.1.0

SendGrid.SmtpApi 1.2.1

My problem is that whenever I start the application locally, it's taking a long time to load the SendGrid SMPT API. In VS I see the following in the status bar along the bottom:

Loading symbols for SendGrid.SmtpApi.dll

It then hangs there for up to about 30 seconds until it finally finishes and the browser finishes loading.

Admittedly not a huge problem on it's own but becomes a pain when doing that operation many times per day.

Is anyone else getting this? Is there anything I can do to speed it up?

Create first time contributor documentation

Issue Summary

Our open sourced documentation has a great first time contributor page that we wish to duplicate here.

Acceptance Criteria

  • We have a file in the root directory called first-timers.md or similar that helps a first time contributor make their first PR (please use our CONTRIBUTOR.md file for inspiration as well as this page)
  • We provide a link to tasks with the labels "difficulty: easy" and "status: help wanted" (example query) to all the repos listed here, please scroll to the bottom.

Warning: 3 References not resolved

Issue Summary

Warnings:
/home/travis/build/sendgrid/smtpapi-csharp/Smtpapi/SendGrid.SmtpApi.sln (default targets) ->
(Build target) ->
/home/travis/build/sendgrid/smtpapi-csharp/Smtpapi/Smtpapi/SendGrid.SmtpApi.csproj (default targets) ->
/usr/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets (ResolveAssemblyReferences target) ->
	/usr/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets:  warning : Reference 'System.Net.Http, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' not resolved
	/usr/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets:  warning : Reference 'System.Net.Http.Extensions, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' not resolved
	/usr/lib/mono/xbuild/14.0/bin/Microsoft.Common.targets:  warning : Reference 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' not resolved

Steps to Reproduce

  1. This is the first step
  2. This is the second step
  3. Further steps, etc.

Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?

Technical details:

  • smtpapi-csharp Version: master (latest commit: [commit number])
  • Platform (WebForms, ASP.NET, ASP.NET Core, etc.)
  • .NET Version: 4.5.2

Add a .env_sample file

Our preference is that users have an environment file when using the SendGrid API, because it is less likely that someone would commit their credentials to github.

Please make a couple changes:

  • make a .env_sample file that contains: export SENDGRID_API_KEY=''
  • make (or add) a .gitignore file and include .env
  • add instructions to the README file about how to copy .env_sample to .env and add the API Key

SMTP server removes sequences.

I'm not sure where to file this issue, if this is not the correct repo, please point me to it.

When using sendgrid via smtp.sendgrid.net sequences get removed. Here is the code i'm using.

var msg = $@"This message
spans multiple
lines

Greetings!
";

message.Body = new TextPart("plain") { Text = msg };
using (var client = new SmtpClient())
{
    await client.ConnectAsync("smtpserver", 587, SecureSocketOptions.Auto);
    await client.AuthenticateAsync("user", "pass");
    await client.SendAsync(message);
    await client.DisconnectAsync(true);
}

When using gmail smtp server, when I look at the email on gmail web client, I see the lines as they were sent.

I then switched to sendgrid smtp server, and at the same client (gmail web) i see the email as one liner, like this:

This message spans multiple lines 
Greetings!

At first I filled the issue at MailKit (the library I'm using) and the response from that library author (who is an expert on mail) suggest that the problem is on the sendgrid end.

Here's the original comment on the issue:
jstedfast/MailKit#380 (comment)

Is there anyway to sendgrid fix this on their end or is something else going on?

message-ID

I dont even know if this is an issue, however support directed me here.

About tracking a particular e-mail this is what they suggested:

For a more comprehensive collection of data, I would suggest using the Event Notification app. This will allow you to gather all the data you need. You will be able to filter the emails by message-ID or recipient addresses.

And I said;

Looks like Event Notification app will solve my problem.
However, with following code I cannot retrieve any message-ID as return;
which service should I use to recieve message-ID in return ?

dynamic sg = new SendGridAPIClient(SendGridApiKey);
 .... //setting recipients, sender and mail body.
var mail = new SendGrid.Helpers.Mail.Mail(from, subject, to, content);
dynamic response = await sg.client.mail.send.post(requestBody: mail.Get());

Currently this is how I send email, and response has no value of message-ID or something close.

So, what do I miss ?

cheers,

emre

Extra space in the substitution variable values

Issue Summary

When sending emails to many recipients (in this case 100) and using substitution variables there will be several emails that have extra space in substitution variable values (in 3 emails of 100). This variable is used in URL so that why it is important not to have any not intended spaces.

Steps to Reproduce

I have attached:

  • Program .cs file with the code from console .NET app which reproduces the bug. It sends 100 emails and extra space is in 25th, 50th, 76th emails - program.txt
  • Received email with extra space which is between "3128795c-2ef" and "3-4b2d-8873-ff99a8309b8f" - emailexample.txt
  • SMTP log I captured with WireShark - wiresharklog.txt

Technical details:

  • smtpapi-csharp Version: SendGrid.SmtpApi.1.3.3
  • Platform ASP.NET
  • .NET Version: 4.6.1

How to configure everything?

As I have to set up the account, I bought a domain to send emails and I'll check it out but I do not know how to make it send the email by smtp

sendgrid.web(credentials).deliver doesn't work with api key credentials

sendgrid.web(credentials).deliver works with original credentials but doesn't work with api key credentials.

Sample code is here.

        SendGridMessage myMessage = new SendGridMessage();
        myMessage.AddTo(MailTo);
        myMessage.From = new MailAddress(MailFrom, "Muses");
        myMessage.Html = "<p></p> ";            
        myMessage.Subject = " ";
        //myMessage.EnableTemplate("<p> <% body %> Hello</p>");
        if (Subject.ToLower() == "Reset_Password".ToLower())
        {
            myMessage.EnableTemplateEngine("442ce4ed-e016-466d-b6f1-eef94bb8b704");
        }
        else if (Subject.ToLower() == "InviteToGroup".ToLower())
        {
            myMessage.EnableTemplateEngine("a58b3bb7-bf82-4d95-98af-be124d24fd1c");
        }            
        myMessage.AddSubstitution("{{CALLBACKURL}}", new List<string> { CallBackURL });
        myMessage.AddSubstitution("{{USERNAME}}", new List<string> { userName });
        // Create credentials, specifying your user name and password.
        var credentials = new System.Net.NetworkCredential("apikey", "api key password");
        var transportWeb = new SendGrid.Web(credentials);
        transportWeb.Deliver(myMessage);

Multiple emails added to header example

I realize that most developer are probably able to do this, but it would be really helpful to have an example of adding a list of emails to the header in c# code. I've read the documentation, but I'm not sure how to apply it to a list of emails. This example would be exceptionally helpful.

Auto-generate the release notes upon release

Issue Summary

For every release, we hand craft the release notes on GitHub, now we would like to automate this process. Please see the existing release notes for an example. The contents of the release notes are generated from the CHANGELOG.md file. Here is the documentation for updating the release notes via the GitHub API.

Acceptance Criteria

  • A script, which when run, creates a release note update based on the last deployed release

Auto-generate the CHANGELOG.md file upon release

Issue Summary

For every release, we currently hand craft a CHANGELOG.md update, now we would like to automate this process. Please see the existing CHANGELOG.md for formatting structure.

Acceptance Criteria

  • A script, which when run, creates a CHANGELOG.md update based on any merged PRs since the last release.

Repo out of date vs Nuget?

tl;dr: It looks like the code here is a version behind Nuget.

I've cloned the main C# libraries (as I prefer to see the code when it's available) but https://github.com/sendgrid/sendgrid-csharp, when referencing https://github.com/sendgrid/smtpapi-csharp instead of the smtapi Nuget package, fails to build with these errors:

Severity Code Description Project File Line Suppression State
Error CS1061 'IHeader' does not contain a definition for 'SetSendEachAt' and no extension method 'SetSendEachAt' accepting a first argument of type 'IHeader' could be found (are you missing a using directive or an assembly reference?) Mail D:\FleetTrackProjects\Open Source\SendGrid-csharp\SendGrid\SendGridMail\SendGrid.cs 264 Active

Severity Code Description Project File Line Suppression State
Error CS1061 'IHeader' does not contain a definition for 'SetSendAt' and no extension method 'SetSendAt' accepting a first argument of type 'IHeader' could be found (are you missing a using directive or an assembly reference?) Mail D:\FleetTrackProjects\Open Source\SendGrid-csharp\SendGrid\SendGridMail\SendGrid.cs 259 Active

The problem appears to be that smtapi NuGet is version 1.3.1, but the version in this repository is 1.3.0. So, where is the source code for smtapi-csharp v1.3.1?

I've resolved for now by adding the following to IHeader:

void SetSendAt(DateTime sendTime);
void SetSendEachAt(IEnumerable sendDateTimes);

Missing destination email C# while using X-SMTPAPI header

Hi,
I'm trying to send email using SendGrid library in c#. When I try to send email using this code(In console application). I'm receiving the error as "missing destination email". I have specified the destination mail in the header. What am I doing Wrong??

      try {
            var header = new Header();

            var recipients = new List<String> { "[email protected]"};
            header.SetTo(recipients);

            var xmstpapiJson = header.JsonString();

            var myMessage = new SendGridMessage();
            myMessage.From = new MailAddress("[email protected]");
            myMessage.Subject = "this is a test email.";
            myMessage.Text = "this is my test email body";

            // add the custom header that we built above
            myMessage.Headers.Add("X-SMTPAPI", xmstpapiJson);

            var transportWeb = new SendGrid.Web("API KEY");
            transportWeb.DeliverAsync(myMessage).Wait();

        }
        catch(Exception e)
        {
                return;
        }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.