public ActionResult CV(MessageToMe message) { if (message.Email != null) { EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings()); email.ContactWotchMe(message); return(View("Dziekuje")); } else { return(View("CV")); } }
public ActionResult Contact(MessageToMe message) { if (ModelState.IsValid) { EmailOrderProcessor email = new EmailOrderProcessor(new EmailSettings()); email.ContactWotchMe(message); return(View("Dziekuje")); } else { return(View("Contact")); } }
public void ContactWotchMe(MessageToMe message)// if someone want to write to me { WebMail.SmtpServer = emailSettings.ServerName; WebMail.SmtpPort = 25; WebMail.EnableSsl = true; WebMail.UserName = emailSettings.Username; WebMail.Password = emailSettings.Password; WebMail.From = emailSettings.MailFromAddress; StringBuilder body = new StringBuilder(); if (message.Company == null && message.Company == null && message.Localization == null) //custumer Asking fo CV { body.AppendLine("Ktoś chce CV od ciebie <br/> Imie: <br/>" + message.Name + "<br/> Nazwisko: <br/>" + message.SurName + "<br/> email: <br/>" + message.Email); } else //Custumer writin something { body.AppendLine("Ktoś napisał do ciebie <br/> Imie: <br/>" + message.Name + "<br/> Nazwisko: <br/>" + message.SurName + "<br/> email: <br/>" + message.Email + "<br/> Firma <br/>" + message.Company + "<br/> Lokalizacja <br/>" + message.Localization + "<br/> Wiadomość <br/>" + message.WriteToMe); } WebMail.Send(emailSettings.MailToAddress, "Message from server", body.ToString()); // body.Clear(); }