//Generate contact mail
        public virtual MvcMailMessage Contact(int fromRouteId, int toRouteId)
        {
            RouteCompare routeCompare = new RouteCompare(fromRouteId, toRouteId);
            ViewData.Model = routeCompare; //Set the strongly typed object for the view
            //Add embedded pictures
            var resources = new Dictionary<string, string>();
            resources["signature"] = HttpContext.Current.Server.MapPath("~/Content/Images/Commute mail signature.png");
            return Populate(x =>
            {
                x.Subject = Resources.Mail_contact_mail_title;
                x.ViewName = "Contact"; //Views/Mail/Contact
                x.ReplyToList.Add(routeCompare.UserMail1); //from user
                x.To.Add(routeCompare.UserMail2); //to user
                x.Bcc.Add("*****@*****.**"); //send me a copy of the mail
                x.LinkedResources = resources; //Embedded images - Commute signature
            });

            //Example on how to use differente smtp client
            //http://stackoverflow.com/questions/9130277/how-set-up-different-stmpclient-instances-in-web-config
        }
 public ActionResult View(int id, int routeId)
 {
     //Route route2 = db.Route.Find(id); //Retrieve route
     //Route route1 = db.Route.Find(routeId); //Retrieve route
     //if (route == null) route = new Route(); //Create a new route if none retrieved
     //IEnumerable<RouteWayPoint> routeWayPoint = from rwp in db.RouteWayPoint
     //                                           where rwp.RouteId == id
     //                                           select rwp;
     //RouteView routeView = new RouteView(route); //, routeWayPoint, Json(routeWayPoint));
     RouteCompare routeCompare = new RouteCompare(routeId, id);
     return View(routeCompare);
 }
 //Contact - test mail sent
 public ActionResult Contact(int fromRouteId, int toRouteId)
 {
     //Send mail as test
     //Mail mail = new Mail();
     //mail.Contact(fromRouteId, toRouteId).Send();
     RouteCompare routeCompare = new RouteCompare(fromRouteId, toRouteId);
     return View(routeCompare); //Display /Views/Welcome the view used to generate mail
 }
 //Send contact mail
 public string MailContact(int fromRouteId, int toRouteId)
 {
     RouteCompare routeCompare = new RouteCompare(fromRouteId, toRouteId);
     Mail mail = new Mail();
     mail.Contact(fromRouteId, toRouteId).Send();
     return "OK";
 }