Snip2Code is shutting down.
It has been quite a ride, since 2013 when we launched our first prototype: thanks to the effort of you guys we collected more than 3 million snippets!
We are very proud to help all our users to be more efficient in their jobs, and to be the central point to share programming knowledge for everyone.
Our basic service is free, so we always survived on our own resources to give you Snip2Code.
Unfortunately, we are no more in the financial position to sustain this effort, and therefore we are announcing here our permanent shut down,
which will take place on August 1st, 2020.
Please save your private snippets using our backup function in the settings, here.
IF YOU WANT TO SAVE SNIP2CODE, PLEASE CONSIDER DOING A DONATION!
This will allow us to pay for the servers and the infrastructure. If you want to donate, Contact Us!
by

How to Retrieve the status of a recipient given the email with MailUp .NET SDK

This snippet takes advantage of the MailUp .NET SDK to setup the secure communication towards the server through OAuth2 two leg authentication.
You can start digging into the MailUP API world by reading this content: http://help.mailup.com/display/mailupapi/REST+API
An instance of MailUpClient class is able to manage one user at a time. 
A MailUpClient object needs a pair clientID-clientSecret, which you can retrieve following this procedure: http://help.mailup.com/display/mailupapi/Authenticating+with+OAuth+v2
Then, you should login with your credentials, invoking RetrieveAccessToken(username, password) method (it should be done just only once at the beginning of the process)
Finally, you can call all the methods you want! 
E.g. to retrieve the status of a recipient you should provide his/her email and the ID of the list which the recipient is subscribed to. The status can be "Unsubscribed", Pending", or "Subscribed". "Unknown" if any error occurred or the recipient is not found.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/228778/How-to-Retrieve-the-status-of-a-recipien?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
public static void GetSubscriptionStatusByEmail(string clientID, string clientSecret, string username, string password) { // 1) Setup the MailUp Client: MailUpClient client = new MailUpClient(clientID, clientSecret); try { client.RetrieveAccessToken(username, password); } catch (MailUpException ex) { Console.WriteLine("Unable to access the service due to " + ex.Message); return; } // 2) Prepare the input: int idList = 1; string emailRecipient = "test@mailup.com"; // 3) Invoke the web method: SubscriptionStatus result = SubscriptionStatus.Unknown; try { result = client.GetSubscriptionStatus(idList, emailRecipient); } catch (Exception ex) { Console.WriteLine("Cannot perform the operation due to " + ex.Message); return; } // 4) Print results: Console.WriteLine("Recipient status: " + result); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus