Wednesday, 5 November 2014

[Return Code 550] sid: RandomSIDHere :: High probability of spam (C# System.Net.Mail Fix)


I have written an emailer application in C# using the System.Net.Mail library. The application allows me to email multiple contacts in large quantities. This is useful for many reasons but I mainly use it for notifying subscribed users of software updates and issue licence keys.

What can be frustrating something sometimes is when you email is bounced back by the receiving party's email server stating that the message could potentially be spam. You will typically receive an email back with something along the lines of: "[Return Code 550] sid: RandomSIDHere :: High probability of spam".

Incoming mail servers typically check for a "Message-Id" header as part of the email. Email clients use this to track the thread of the message among other things. You can read more about Message-Id here.

We can attach a Message-Id attribute to our outgoing mail messages in C# with one very simple line of code (Where 'mail' is a MailMessage object)

Code Snippet
  1. mail.Headers.Add("Message-Id", string.Format("<{0}@{1}>", Guid.NewGuid().ToString(), "yourdomain.com"));
End of Code Snippet

Tuesday, 4 November 2014

C# and VB.NET - Google Chrome WebBrowser Control for WinForms and WPF


Anybody that has used the inbuilt WebBrowser control in WinForms and WPF has noticed that it's an old version of Internet Explorer can throws a lot of script errors, renders pages badly and is prone to memory leaks.

This blog post will provide a little insight into using The Chromium Embedded Framework (CEF) as an alternative. Chromium in a nutshell is basically a development release of Google Chrome. When a chosen release has been put through testing and deployed, it is a simply a new version of Google Chrome.

Chromium Embedded Framework (CEF) is an open source project and actively maintained (As of 2014)... These are two good things we look for when re-using existing development frameworks. You can visit the CEF development page here.

External Projects
The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues.

.Net - https://github.com/chillitom/CefSharp
.Net (CEF1) - https://bitbucket.org/fddima/cefglue
.Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/
Delphi (CEF3) - http://code.google.com/p/dcef3/
Go - https://github.com/CzarekTomczak/cef2go
Java - http://code.google.com/p/javachromiumembedded/
Java - http://code.google.com/p/javacef/
Python - http://code.google.com/p/cefpython/

For C# and VB.NET applications, I recommend CefSharp. Download via NuGet and add to your project with ease!

CefSharp
This project contains .NET CLR bindings for The Chromium Embedded Framework (CEF) by Marshall A. Greenblatt. A small Core of the bindings are written in C++/CLI but the majority of code here is C#. It can of course be used from any CLR language, e.g. C# or VB.

CefSharp provides both WPF and WinForms web browser control implementations. See the CefSharp.Wpf.Example or CefSharp.WinForms.Example projects for example web browsers built using this library; they are (at this moment) the best "documentation" of features. In addition see the CefSharp.MinimalExample repo for how CefSharp can actually be used via NuGet packages.

Sunday, 2 November 2014

Encode and Decode to Base64 in C#


Base64
Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.

Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, and storing complex data in XML.

Here is a simple static class that allows you to Encode and Decode a value to and from Base64 encoding!

Code Snippet
  1. public class Base64Helper
  2. {
  3.     public static string Encode(string plainText)
  4.     {
  5.         var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
  6.         return System.Convert.ToBase64String(plainTextBytes);
  7.     }
  8.  
  9.     public static string Decode(string base64EncodedData)
  10.     {
  11.         var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
  12.         return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
  13.     }
  14. }
End of Code Snippet

Thursday, 30 October 2014

C# WinForms - How to Select All Text in a Multiline Textbox


You can either override KeyUp or KeyDown for your TextBox. Simply use the following code...


Code Snippet
  1. private void TextBox_KeyUp(object sender, KeyEventArgs e)
  2. {
  3.     if (e.KeyData == (Keys.Control | Keys.A))
  4.         TextBox.SelectAll();
  5. }
End of Code Snippet

Wednesday, 29 October 2014

Email Marketing Lists - Email Lists - Targeted Business Email Campaigns


Web Contact Scraper is a fully automated software application for gathering targeted business contact information!
Web Contact Scraper allows you to retrieve thousands of business contact information entries in real-time. You can use this information to start your very own business campaign. Are you a new business owner? Want to advertise to other similar businesses to promote yourself or a service? Then Web Contact Scraper is for you!
Web Contact Scraper allows you to set multiple business key words and locations within a single search. For example, you can search for: Construction, Plumbing, Electricians, Building, Landscaping in all 50 states! While this search may take a little time to complete, you can leave the application running while you see results appear in real-time! No more waiting for long queries to complete!
Web Contact Scraper allows you to remove duplicate contact information on-the-fly.
You may chose to export you results to CSV any time!
Web Contact Scraper includes proxy support to build your business databases anonymously!
  • Search for multiple business key words (I.e. Construction, Dentist, Lawyer)
  • Search within multiple cities, states and countries!
  • See the search results appear in real-time!
  • In-built tool to remove duplicate contact information
  • Export results to CSV
  • Proxy IP Support to scrape anonymously!
  • Lifetime Licence Key for up to 2 Computers
  • 1 Full Year of Free Product Updates
  • Excellent Customer Support Service
  • All This for Only $19.95!

- See more at: http://ginkosolutions.com/webcontactscraper


How to get Business Data & Contact Information (Web Contact Scraper)


Web Contact Scraper is a fully automated software application for gathering targeted business contact information!
Web Contact Scraper allows you to retrieve thousands of business contact information entries in real-time. You can use this information to start your very own business campaign. Are you a new business owner? Want to advertise to other similar businesses to promote yourself or a service? Then Web Contact Scraper is for you!
Web Contact Scraper allows you to set multiple business key words and locations within a single search. For example, you can search for: Construction, Plumbing, Electricians, Building, Landscaping in all 50 states! While this search may take a little time to complete, you can leave the application running while you see results appear in real-time! No more waiting for long queries to complete!
Web Contact Scraper allows you to remove duplicate contact information on-the-fly.
You may chose to export you results to CSV any time!
Web Contact Scraper includes proxy support to build your business databases anonymously!
  • Search for multiple business key words (I.e. Construction, Dentist, Lawyer)
  • Search within multiple cities, states and countries!
  • See the search results appear in real-time!
  • In-built tool to remove duplicate contact information
  • Export results to CSV
  • Proxy IP Support to scrape anonymously!
  • Lifetime Licence Key for up to 2 Computers
  • 1 Full Year of Free Product Updates
  • Excellent Customer Support Service
  • All This for Only $19.95!

- See more at: http://ginkosolutions.com/webcontactscraper


Wednesday, 22 October 2014

C# - How to Return a Substring Between Two Strings


Here is a non-RegEx solution for returning a substring between two strings in C#. I have also added a function for retrieving multiple occurrences which outputs as a List of strings.

The parameters called: includeFrom and includeUntil allow you to append the from and until fields to the result.


Usage:

Code Snippet
  1. // Example for one occurrences
  2. // This extracts 'Message Here' from this example chat log
  3. string message = "[12th July 2014] Message Here (Sent by Sean)".Substring(from: "]", until: "(", includeFrom: false, includeUntil: false);
  4. // Example for multiple occurances
  5. // This extracts all of the names which are enclosed between single quotes
  6. List<string> listOfNames = "'sean' random text 'dave' 355353 'jane' some text here 'tom'".SubstringAll(from: "'", until: "'");
End of Code Snippet



The Code:
Code Snippet
  1. /// <summary>
  2. /// Returns a substring between two anchor strings
  3. /// If from is null - Start of the string until the Second anchor
  4. /// If until is null - First anchor to the end of the string is returned
  5. /// </summary>
  6. /// <param name="this">Input string</param>
  7. /// <param name="from">An optional string to search after</param>
  8. /// <param name="until">An optional string to search before</param>
  9. /// <param name="includeFrom">Include from in the result</param>
  10. /// <param name="includeUntil">Include until in the result</param>
  11. /// <param name="comparison">An optional comparison for the search</param>
  12. /// <returns>A substring based on the search</returns>
  13. public static string Substring(this string @this, string from = null, string until = null, bool includeFrom = false, bool includeUntil = false, StringComparison comparison = StringComparison.InvariantCulture)
  14. {
  15.     var fromLength = (from ?? string.Empty).Length;
  16.     var startIndex = !string.IsNullOrEmpty(from)
  17.         ? @this.IndexOf(from, comparison) + fromLength
  18.         : 0;
  19.  
  20.     if (startIndex < fromLength) { return string.Empty; }
  21.  
  22.     var endIndex = !string.IsNullOrEmpty(until)
  23.     ? @this.IndexOf(until, startIndex, comparison)
  24.     : @this.Length;
  25.  
  26.     if (endIndex < 0) { return string.Empty; }
  27.  
  28.     if (includeFrom) // Do these AFTER start and end have been calculated
  29.         startIndex -= from.Length;
  30.     if (includeUntil)
  31.         endIndex += until.Length;
  32.  
  33.     return @this.Substring(startIndex, endIndex - startIndex);
  34. }
  35.  
  36. /// <summary>
  37. /// Returns a List of substrings between two anchor strings
  38. /// If from is null - Start of the string until the Second anchor
  39. /// If until is null - First anchor to the end of the string is returned
  40. /// </summary>
  41. /// <param name="this">Input string</param>
  42. /// <param name="from">An optional string to search after</param>
  43. /// <param name="until">An optional string to search before</param>
  44. /// <param name="includeFrom">Include from in the result</param>
  45. /// <param name="includeUntil">Include until in the result</param>
  46. /// <param name="skipEmptyResults">If empty results are found, then they are not added to the result set.</param>
  47. /// <param name="comparison">An optional comparison for the search</param>
  48. /// <returns>A List of substrings based on the search</returns>
  49. public static List<string> SubstringAll(this string @this, string from = null, string until = null, bool includeFrom = false, bool includeUntil = false, bool skipEmptyResults = true, StringComparison comparison = StringComparison.InvariantCulture)
  50. {
  51.     List<string> result = new List<string>();
  52.     try
  53.     {
  54.         while (true)
  55.         {
  56.             string res = @this.SubstringEx(from, until, includeFrom, includeUntil, comparison);
  57.  
  58.             if (!skipEmptyResults || !string.IsNullOrEmpty(res)) // Skip empty result sets
  59.                 result.Add(res);
  60.  
  61.             res = (!includeFrom) ? from + res : res;
  62.  
  63.             // If from and until are the same, then we can end up with problems and only returning half the result set. This fixes that problem.
  64.             if (from != until)
  65.                 res = (!includeUntil) ? res + until : res;
  66.  
  67.             @this = @this.Replace(res, string.Empty);
  68.         }
  69.     }
  70.     catch { }
  71.  
  72.     return result;
  73. }
End of Code Snippet

Monday, 20 October 2014

Etsy Toolbox - Add Followers, Message Users, Favourite Shops and More!


I came across this application called Etsy Toolbox, written by a former college room mate and I thought I would help him out by posting his software here. It's a great Etsy Shop tool and aides SEO.

- See more at: http://ginkosolutions.com/etsytoolbox

Etsy Toolbox is a low cost solution for marketing your Etsy Store. The application allows you to automatically add/remove followers, add/remove favourites and send messages to users on a large scale!


  • Add/Remove Etsy Followers... Getting your Etsy Store Noticed!
  • Add/Remove Etsy Favourites... Boosting your Stores Search Ranking
  • Mass Message Etsy Users, Followers and Favouriters!
  • Manage Message Templates with an In-built Template Management Tool
  • Manage Multiple Etsy Stores within one Single Application!
  • Build a Custom Unique Audience by Controlling Which Users to Follow/Favourite and Message Based on Custom Search Criteria
  • Proxy IP Support
  • Lifetime Licence Key for up to 2 Computers
  • 1 Full Year of Free Product Updates
  • Excellent Customer Support Service
  • All This for Only $29.95!

- See more at: http://ginkosolutions.com/etsytoolbox

Get Etsy Followers - Get Etsy Shop Noticed - Get Etsy Sales - Etsy Toolbox


I came across this application called Etsy Toolbox, written by a former college room mate and I thought I would help him out by posting his software here. It's a great Etsy Shop tool and aides SEO.

- See more at: http://ginkosolutions.com/etsytoolbox

Etsy Toolbox is a low cost solution for marketing your Etsy Store. The application allows you to automatically add/remove followers, add/remove favourites and send messages to users on a large scale!


  • Add/Remove Etsy Followers... Getting your Etsy Store Noticed!
  • Add/Remove Etsy Favourites... Boosting your Stores Search Ranking
  • Mass Message Etsy Users, Followers and Favouriters!
  • Manage Message Templates with an In-built Template Management Tool
  • Manage Multiple Etsy Stores within one Single Application!
  • Build a Custom Unique Audience by Controlling Which Users to Follow/Favourite and Message Based on Custom Search Criteria
  • Proxy IP Support
  • Lifetime Licence Key for up to 2 Computers
  • 1 Full Year of Free Product Updates
  • Excellent Customer Support Service
  • All This for Only $29.95!

- See more at: http://ginkosolutions.com/etsytoolbox

Free VPN Servers - USA, Canada and European Servers


It's a well known fact that using the internet exposes personal information regarding things such as: Your browsing habits, sensitive information and more. We can try and avoid circumstances such as these by using private sessions (private/incognito mode) in browsers like Firefox and Google Chrome. However, this isn't typically enough. So, how can we protect ourselves and our personal information?

Proxies
Use of proxies and anonymous proxies have been around since the birth of the internet. It is a means where we can establish a connection to our target (I.e. Google.com) using another computer or server. We are exposed to the target as the proxy server, thus protecting our true identity (Sometimes your IP is passed in a request header, so it's good to check this first)!
However, proxy lists are very well used by spammers, scammers, auto-emailers, auto-forum posters these days and you'll find that some websites have blacklisted these IP addresses. More importantly, the proxy server may purely exist as a honeypot. Proxy servers should generally never be trusted with sensitive information (Passwords, bank details etc.) unless it's administrator is known to you.

Virtual Private Network (VPN)
Moving on to VPN services... A VPN is a private network, typically operated by a company or business. Like a proxy server, your target (I.e. Google.com) identifies you as a user of the VPN and your IP address you expose to your target will reflect this. A VPN is a fancy way of saying "A group of computers which can hook up to a large public group of computers, such as the internet".

Websites such as HideMyAss.com offer a VPN service for a monthly charge (Around $10). See a cost and service comparison chart here.

Free VPN services exist, but similar to proxy servers, these free VPN services can exist as a honeypot. A good way of inspecting free VPN solutions (and proxy servers for that matter) is to find trusting users who have reviewed them. As a trusting user, I can offer a recommendation for a free VPN service called VPNBook.

Download Links
Download VPNBook Servers
Download OpenVPN Client (For connecting to VPNBook Servers)
Independent VPNBook Review