Store SendGrid api key in C# App on AppHarbor

ToniTurek's Avatar

ToniTurek

27 Jun, 2019 08:26 AM

Dear AppHarbor support team,
In my app, I am using SendGrid for user account verification. Currently, I struggle where to store the sendgrid api key in my code.
I read the support article
https://support.appharbor.com/kb/getting-started/sending-emails
in which it is recommended to just use a SmtpClient() and AppHarbor will to the rest but on the SendGrid support site (https://sendgrid.com/solutions/email-api/), a different approach is used getting the api key from an environment variable:
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");

Can you please help me with a small example how to store the sendgrid api key in my c# app?

Thanks,
Jan

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac