public string updateEmail(MessageFromPastSelf messageFromPastSelf) { BackgroundJob.Delete(messageFromPastSelf.jobid); return(BackgroundJob.Schedule( () => sendEmail(messageFromPastSelf), TimeSpan.FromSeconds(messageFromPastSelf.when))); }
public void sendEmail(MessageFromPastSelf messageFromPastSelf) { using (var message = new MailMessage()) { Console.WriteLine(this._email); Console.WriteLine(this._password); message.To.Add(new MailAddress(messageFromPastSelf.To)); message.From = new MailAddress(this._email); message.Subject = messageFromPastSelf.Subject; message.Body = messageFromPastSelf.Body; message.IsBodyHtml = messageFromPastSelf.IsBodyHtml; using (var client = new SmtpClient("smtp.gmail.com")) { client.Port = 587; client.Credentials = new NetworkCredential(_email, _password); client.EnableSsl = true; client.Send(message); } } }
public bool deleteEmail(MessageFromPastSelf messageFromPastSelf) { return(BackgroundJob.Delete(messageFromPastSelf.jobid)); }
public string scheduleEmail(MessageFromPastSelf messageFromPastSelf) { return(BackgroundJob.Schedule( () => sendEmail(messageFromPastSelf), TimeSpan.FromDays(messageFromPastSelf.when))); }