using System.Text.RegularExpressions;
using System.Collections.Generic;
namespace Multiline_Email_Test
public static void Main()
string email = @"NOTIFICATION OF MOVEMENT STARTING IN AUGUST
Consignor Package ID Local Reference Number
------------------- ----------------------
Place Of dispatch Guarantor type code
----------------- -------------------
Consignee Package ID Guarantor details
----------------- -------------------
Place Of delivery Date of dispatch DD MM YYYY
----------------- ---------------------------
Vehicle registration number
---------------------------
Item number Package Product CN CodeCode Quantity Brand
----------- ------------------------- -------- -----
Line 1 of 2 B000 22040009 7603.200 Guinness DIC 440ml CAN 06X04 MDCES
Line 2 of 2 B000 22040009 14636.160 Guinness DIC 440ml CAN 06X04 MDCES
var dict = new Dictionary<string, string>();
var lines = email.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
int starts = 0, end = 0, length = 0;
while (!lines[starts + 1].StartsWith("-"))
for (int i = starts + 1; i < lines.Length; i += 3)
var mc = Regex.Matches(lines[i], @"(?:^| )-");
int start = m.Value.StartsWith(" ") ? m.Index + 1 : m.Index;
while (lines[i][end++] == '-' && end < lines[i].Length)
length = Math.Min(end - start, lines[i - 1].Length - start);
string key = length > 0 ? lines[i - 1].Substring(start, length).Trim() : "";
while (lines[i][end++] == '-' && end < lines[i].Length)
length = Math.Min(end - start, lines[i + 1].Length - start);
string value = length > 0 ? lines[i + 1].Substring(start, length).Trim() : "";
throw new Exception(ex.ToString());
Console.WriteLine("{0} : {1}", x.Key, x.Value);