{"id":10555,"date":"2018-08-14T14:18:00","date_gmt":"2018-08-14T14:18:00","guid":{"rendered":"https:\/\/viewmyprojects.com\/winwirewp\/?p=10555"},"modified":"2024-04-17T11:39:19","modified_gmt":"2024-04-17T11:39:19","slug":"sending-emails-using-sendgrid-in-microsoft-azure","status":"publish","type":"post","link":"https:\/\/viewmyprojects.com\/winwirewp\/blog\/sending-emails-using-sendgrid-in-microsoft-azure\/","title":{"rendered":"Sending Emails using SendGrid in Microsoft Azure"},"content":{"rendered":"\n<p>While working on the projects, we might have a requirement to send emails to a set of recipients programmatically. For this, we usually use the SMTP server created at the client end for sending the emails, which involves a considerable amount of cost and maintenance of servers for the client. However, if we have to deal with low cost, low maintenance and also hold an Azure Subscription, then we can go about using the SendGrid Email Delivery Service available in&nbsp;<a href=\"https:\/\/azure.microsoft.com\/en-in\/\" target=\"_blank\" rel=\"noopener\">Microsoft Azure<\/a>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is SendGrid?<\/strong><\/h2>\n\n\n\n<p><br>SendGrid is a cloud-based SMTP provider used to deliver marketing and transactional emails. SendGrid maintains email server on your organization\u2019s behalf, so your messages are sent and delivered as needed.<\/p>\n\n\n\n<p>SendGrid manages all of the technical requirements, from infrastructure to ISP outreach and monitoring to whitelist services and real-time analytics. It\u2019s the world\u2019s largest cloud-based service for delivering emails.<\/p>\n\n\n\n<p>There are several ways to use SendGrid\u2019s email services. However, it all depends on your requirement and what you want to accomplish.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>How to set up and use SendGrid in Azure<\/strong><\/h4>\n\n\n\n<p>Before you start, please ensure you have an active SendGrid Account in the Azure subscription<\/p>\n\n\n\n<p>Follow below steps for creating a SendGrid Account and getting the details to send an email using SendGrid.<\/p>\n\n\n\n<p>1. Login to the Azure subscription<\/p>\n\n\n\n<p>2. Search for the \u2018SendGrid Email Delivery\u2019 service in the search box as shown below<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery-1024x484-1.webp\" alt=\"\" class=\"wp-image-18496\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery-1024x484-1.webp 1024w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery-1024x484-1-300x142.webp 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery-1024x484-1-768x363.webp 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3. Click on the \u2018SendGrid Email Delivery\u2019 from the list. You will be navigated to the below screen for creating an account for SendGrid.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"497\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_2-1024x497-1.webp\" alt=\"\" class=\"wp-image-18500\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_2-1024x497-1.webp 1024w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_2-1024x497-1-300x146.webp 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_2-1024x497-1-768x373.webp 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4. Provide the required details like Name, Password, Subscription, Resource Group.<\/p>\n\n\n\n<p>5. Choose the Pricing tier as shown below.<\/p>\n\n\n\n<p>SendGrid provides several plans and pricing based on your requirements. The pricing depends on the features and the number of emails to be sent per month. It offers a free plan which will help you send 25,000 emails per month. For the demo, we will select the free plan.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"519\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_3-768x519-1.webp\" alt=\"\" class=\"wp-image-18499\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_3-768x519-1.webp 768w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_3-768x519-1-300x203.webp 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>6. Provide the contact information as mentioned below. This might be used for sending any information if the plan needs any upgrade based on your usage. Once all the information is provided, click \u2018OK\u2019.<\/p>\n\n\n\n<p>7. For the legal terms, click the \u2018Create\u2019 button as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"516\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_5-768x516-1.webp\" alt=\"\" class=\"wp-image-18498\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_5-768x516-1.webp 768w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_5-768x516-1-300x202.webp 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>8. The input is validated and once the \u2018Validation Successful\u2019 message is displayed, click the\u2018Create\u2019 button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"596\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_6.webp\" alt=\"\" class=\"wp-image-18497\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_6.webp 320w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_6-161x300.webp 161w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n\n\n\n<p>9. The account creation will take a couple of minutes. SendGrid account is displayed in the corresponding resource group as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"552\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2022\/03\/SendGrid-Email-Delivery_7-1024x552-1.png\" alt=\"\" class=\"wp-image-10561\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2022\/03\/SendGrid-Email-Delivery_7-1024x552-1.png 1024w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2022\/03\/SendGrid-Email-Delivery_7-1024x552-1-300x162.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2022\/03\/SendGrid-Email-Delivery_7-1024x552-1-768x414.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>10. Click on the SendGrid account created and navigate to the settings page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"500\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_8-768x500-1.webp\" alt=\"\" class=\"wp-image-18495\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_8-768x500-1.webp 768w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_8-768x500-1-300x195.webp 300w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/figure>\n\n\n\n<p>11. Click on \u2018Configurations\u2019 link and copy the \u2018USERNAME\u2019 and \u2018SMTP SERVER.\u2019 Remember to use the password provided while creating the account. These will be your SMTP credentials to send the email programmatically.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"630\" height=\"586\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_9.webp\" alt=\"\" class=\"wp-image-18494\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_9.webp 630w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_9-300x279.webp 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\n\n\n\n<p><strong>Sending email using SendGrid Account \u2013 SMTP Relay (C# code):<\/strong><\/p>\n\n\n\n<p>Below is the sample code which sends an email using the SMTP relay of the SendGrid account created in the steps as mentioned earlier.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"652\" height=\"385\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_10.webp\" alt=\"\" class=\"wp-image-18493\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_10.webp 652w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_10-300x177.webp 300w\" sizes=\"auto, (max-width: 652px) 100vw, 652px\" \/><\/figure>\n\n\n\n<p><strong>SendGrid Dashboard:<\/strong><\/p>\n\n\n\n<p>The email activity created using SendGrid account can be monitored in the Azure Portal.<\/p>\n\n\n\n<p>Click on \u2018Manage\u2019 on the SendGrid account page and navigate to SendGrid App site. The dashboard provides information on the emails requested, delivered and more.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"506\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_11-1024x506-1.webp\" alt=\"\" class=\"wp-image-18492\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_11-1024x506-1.webp 1024w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_11-1024x506-1-300x148.webp 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2018\/02\/SendGrid-Email-Delivery_11-1024x506-1-768x380.webp 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>While working on the projects, we might have a requirement to send emails to a set of recipients programmatically. For this, we usually use the SMTP server created at the client end for sending the emails, which involves a considerable amount of cost and maintenance of servers for the client. However, if we have to&hellip; <a class=\"more-link\" href=\"https:\/\/viewmyprojects.com\/winwirewp\/blog\/sending-emails-using-sendgrid-in-microsoft-azure\/\">Continue reading <span class=\"screen-reader-text\">Sending Emails using SendGrid in Microsoft Azure<\/span><\/a><\/p>\n","protected":false},"author":31,"featured_media":16668,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-10555","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","entry"],"acf":[],"featured_image_src":"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp","author_info":{"display_name":"Sree Navya","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/sreenavya\/"},"views":4555,"uagb_featured_image_src":{"full":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp",800,440,false],"thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid-150x150.webp",150,150,true],"medium":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid-300x165.webp",300,165,true],"medium_large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid-768x422.webp",750,412,true],"large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp",750,413,false],"1536x1536":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp",800,440,false],"2048x2048":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp",800,440,false],"post-thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2023\/11\/sendgrid.webp",800,440,false]},"uagb_author_info":{"display_name":"Sree Navya","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/sreenavya\/"},"uagb_comment_info":0,"uagb_excerpt":"While working on the projects, we might have a requirement to send emails to a set of recipients programmatically. For this, we usually use the SMTP server created at the client end for sending the emails, which involves a considerable amount of cost and maintenance of servers for the client. However, if we have to&hellip;&hellip;","_links":{"self":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/10555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/comments?post=10555"}],"version-history":[{"count":2,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/10555\/revisions"}],"predecessor-version":[{"id":18542,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/10555\/revisions\/18542"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media\/16668"}],"wp:attachment":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media?parent=10555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/categories?post=10555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/tags?post=10555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}