I'm Speaking on a Boat

Well, it's more than a boat is a cruise ship, the Norweigan Cruise Lines Escape. We will be departing from Miami with port stops in Falmouth (Jamaica); George Town (Grand Cayman); Great Stirrup Cay (Bahamas); Nassau (Bahamas); and come back to Miami.

Chris Woodruff and I will be providing 2 and half days of instruction on .NET Core at TechOutbound. It'll be a combination of instruction and hands on workshops. Here's the topics we will be covering.

  • C# 7
  • Entity Framework Core 2.0
  • ASP.NET Core MVC
  • ASP.NET Core Web API
  • Client-side Development with ASP.NET Core
  • Security and Identity
  • Testing
  • Debugging and Performance
  • Hosting and Deployment
  • Migrating from.NET Framework
  • Docker and Containers
  • ASP.NET Core and the Cloud

Register now by following the instructions and use code BFFJG when you do for an additional $100 off your registration

Using SendGrid and emails are not being delivered to Hotmail/Outlook/Live/MSN.com recipients?

Me too, or at least I was... While the problem I was having might not be related to SendGrid exclusively, I am going to talk about the solution.

The Problem

Before I go into the solution, let's talk about the problem first. Many of you know that I run Desert Code Camp in Chandler, AZ. Originally, the site ran on the Microsoft stack, it used ASP.NET (Web Forms) and SQL Server. There is an API for mobile apps and future development but that's another story. The site has 12,000 registered users. A few thousand are SPAM/Bots, a few thousand are "inactive" accounts (opted out or moved), and the other 6000 or so are active users that have an interest in Desert Code Camp or have attended at least one.

And here lies the first problem.

When an announcement email goes out to our attendees or users of the site, we need to send out about 6000 emails. I used to do this by sending the email from a web page through code using System.Net.SMTP via localhost. At first, it wasn't an issue. After a while, as Desert Code Camp grew, this became more and more of a problem. Typically the page would time out or IIS would die or something. So I needed to find a solution. Sometime last year, probably around this time, I offloaded the processing of emails to Azure Queue Storage and used Azure WebJobs to handle the "logic". But wait, Azure does not support sending stuff via localhost. And that is true! This is where SendGrid comes into play. Azure provides, as of the creation of this post, a free 25,000 email per month subscription to SendGrid. For more on that, check out this post.

Now that I implemented the new Azure/SendGrid combination everything was great.

Fast forward a year, to this past weekend, I announced that the next Desert Code Camp was happening on Twitter and some people started submitting sessions. This is great! But I noticed that I was wasn't getting my emails about the submissions.  At first, I thought, "Oh Joe, you forgot something when you 'created' the new event".  It happens every time :). However, this was not the case this time. Microsoft decided to embrace something called DMARC, Domain-based Message Authentication, Reporting & Conformance. In a nutshell, it checks to see if you are sending emails from the domain you claim you are sending them from, which for me was bad.  Not because I was trying to be deceitful, but because I was sending emails saying they were from '@hotmail.com' and sending them via 'SendGrid' because I wanted people to reply to my Hotmail address. Well, when Microsoft implemented the DMARC...

What this means: As of June 2016, you can no longer send with the From address being anything from a Microsoft address when sending to a domain that checks DMARC before accepting mail.

... it saw my email as not being 'legitimate' and did not deliver it to my inbox and probably others.

The Solution

The answer is 'Whitelist' your domains while using SendGrid. There are more detailed instructions on how to whitelist a domain using SendGrid here.

What is Whitelabeling?

Whitelabeling allows you to send through your own custom domain instead of SendGrid's default settings. This will mask the header information of your emails with your data--not theirs--and will improve your email deliverability.

Non-Whitelabeled Example vs. Whitelabeled Example

Luckily, SendGrid makes it easy to whitelist your domain(s). Here is how you do it. Please note: You will need access to your domain records, you will be making changes to your TXT or CNAME entries to prove you have rights to the domain.

  • First, log-in to your SendGrid Account
  • Click 'Settings' (on the left)
  • Click 'Whitelabels'
  • Click + Add Domain button.
  • SendGrid will walk you though everything else you need.

But what about the replies to @Hotmail.com

I'm glad you are still with me :). This part is the easy part. Essentially, I added 'noreply@desertcodecamp.com' as the ToAddress and added 'jguadagno@hotmail.com' as the ReplyTo. As shown in this gist.

I hope this saves you some time to troubleshoot mail delivery to @hotmail.com, @outlook.com, @live.com, @msn.com, @yahoo.com, and @gmail.com.

jQuery Twitter Bootstrap Flickr Carousel

A few months ago I built a jQuery plugin that uses the Twitter Bootstrap Carousel to cycle through images on Flickr. In order to use this plugin you need to get an Api Key from Flickr and have the following software:

  • jQuery (v1.8 or higher)
  • Twitter Bootstrap (v3.0 or higher)
  • Twitter Bootstrap components (v3.0 or higher)
  • twbsPagination (optional)

Sample Usage

Download the plugin from GitHub at: //github.com/jguadagno/twbs-flickrCarousel

See an example of usage at: //mvp2014.mvpsummitevents.info/flickr

Taking the “Leap” to Everleap

For the past 5+ years I’ve had a few different sites hosted at Discount ASP.NET, this site being one of them. Recently, Discount ASP.NET released a new product in the web hosting arena, Everleap. Everleap is a new cloud based hosting solution.  I know, the word “cloud” is massively overused nowadays.  Everleap differs from other solutions as it uses the Windows Azure Pack for it’s services. The Windows Azure Pack is the same technology that Microsoft uses to run their own Windows Azure hosting platform. Microsoft has made Azure technologies available to their partners so they can build public and private cloud offerings that run in the their own data centers. For more on the Windows Azure Pack check out //www.everleap.com/cloud-hosting/features/azure-pack-hosting/

The move to Everleap

The move to Everleap was easy considering I already had my site on Discount ASP.NET

  1. Open up an Everleap account: Cloud Websites or Multi-Domain Cloud
  2. Create a Discount ASP.NET support ticket requesting the move
  3. In a few hours or so, the new sites were created and moved over. They even updated web.config with the new database connection strings and smtp settings.
  4. If you do not use Discount ASP.NET to register your domains, you will have to log in to your registrar to update the DNS servers to point to the new Everleap DNS servers.

That was it.

If you need a scalable site where you can increase and decrease the number of servers as needed and want predicable billing, Everleap might be the solution for you.

Disclaimer: I was given a free Everleap account to host this site and other community sites that I run like Desert Code Camp. This is not a sponsored post.

Foursquare Autocomplete jQuery Plugin

This post will go over implementing the foursquare Autocomplete jQuery plugin. In the upcoming days (weeks) I will have a few blog posts on using the foursquare API with C#.

A few months ago I was making updates for the MVP Summit Events site, one of the features I wanted to add was foursquare integration to the site. I was thinking that it would be cool for each of the parties listed on the site, to show how many people have checked in to that event (venue) on foursquare. This way you could see what parties to attend and which ones to avoid :).

In order to determine who was checked in at one of the events, I needed to add the foursquare venue id to all of my venues. For the existing venues, I manually added the foursquare venue id but for new venues I was thinking of making the user experience as easy as possible, a user should enter a few characters and get venues in the area with those characters. The first thing that popped into my head was to use an auto complete control and use foursquare as the data source. So after “Googling it with Bing” I found that there was one control that did this but no longer worked. So what does every good developer do, re-invent the wheel :).

Getting Started with the foursquare API

Just like most social media sites now, foursquare has a REST based API. Foursquare provides a quick start guide to get you started using their API. In order to get started with the foursquare API you will need the following:

foursquare does have many API end points for accessing their data. After checking out several of them I decided to go with the Suggest Completion Venues end point even though (at the time of this writing it was an experimental feature).

Suggest Completion End Point

According to the API end point documentation for the Suggest Completion end point, the end point provides a list of mini-venues partially matching the search term, near the location.

The method uses the HTTP GET verb and has two required parameters; ll and query. The ll parameter which is the latitude and longitude of the users location (or search area) . And the query parameter is the string you want to search for. The results that get returned is an array of mini venues (essentially an arrays without a lot of extra properties, just the minimum set required for suggestion.

This was perfect for my needs.

Creating the plugin

I decided to go with using the auto complete widget from the jQuery UI, use the suggest completion end point from foursquare and turn it into a jQuery plugin. Unfortunately I have never created a jQuery plugin before, however, I was lucky enough to run across a post from a buddy of mine Elijah Manor on How to Create Your Own jQuery Plugin.

After a few hours of fiddling around with the cost from the blog post above I eventually figured it out and got it to work. The resulting control looks like this:

image

In order to use the foursquare jQuery auto complete plugin you will need to include on your page, jQuery, jQuery UI, one of the jQuery UI themes and this plugin.

I’ve also included a sample page to get you started. It has a bunch of styles to make the use of the plugin a little cleaner.

4sqautocomplete

Once you have the required files referenced on your page, you can “foursquare auto complete” a textbox by calling the foursquareAutocomplete method as shown here:

Properties and Events
NameDescription
latitudeThe latitude where you want to look for the venue.
longitudeThe longitude where you want to look for the venue.
oauth_tokenYour foursquare oauth token.
minLengthThe minimum length the text should be before you kick off the search.
searchThis event is fired once the user selects a venue from the list.
onErrorThis event is fired if there is an error returned from the foursquare REST API.
onAjaxErrorThis event is fired if there is an error making the call to the foursquare REST API.

Handling the results

Once a user selects the venue from the list, the search event is raised. The search event has two parameters:

  • Event: The event
  • Item: the foursquare venue that was returned.

The item that is returned is a custom object that provides the basic address properties for the venue. The properties combined, will look like a US formatted address and will take into account fields that are not populated in foursquare.

image

Item properties
Property NameDescription
nameThe name of the venue
idThe foursquare venue id
addressThe address line (formatted like a US address) address1, address2
cityLineThe city line (formatted like a US address). Chandler, AZ 85286
photoThe 32 pixel image that foursquare uses for the venue.
fullThe entire mini-venue response returned from foursquare.

Conclusion

It took a while for me to figure out all of the parts needed to create the jQuery plugin but overall I think it was worth it. Again this is my first venture into creating a jQuery plugin, so if it is way off, let me know.