public void SendEmailPickupInvite(int userId, string pickupUrl) { var dbUser = BlogDb.GetTable<User>().FirstOrDefault(a => a.UserId == userId); if (dbUser == null) { return; } var invite = new EmailVerification { Created = DateTime.UtcNow, Expires = DateTime.UtcNow.AddHours(30), Id = Guid.NewGuid(), UserId = userId }; var from = new MailAddress("*****@*****.**"); var to = new[] { new MailAddress(dbUser.Email) }; var subject = "Confirm your email"; var replacedUrl = pickupUrl.Replace(Guid.Empty.ToString(), invite.Id.ToString()); var htmlBuilder = new StringBuilder(); htmlBuilder.Append("<p>Hello there,</p>") .Append("<p>This is your email verification for an eouw0o83hf.com blog. Please click on the link provided below to verify this email address.</p>") .Append("<p><a href=\"").Append(replacedUrl).Append("\">") .Append(replacedUrl) .Append("</a></p>") .Append("<p>If you did not register for this site, please simply ignore this email and we'll forget about it.</p>"); var message = SendGrid.Mail.GetInstance(from, to, new MailAddress[0], new MailAddress[0], subject, htmlBuilder.ToString(), null); var creds = new NetworkCredential(SendGridUsername, SendGridPassword); var transport = SendGrid.Transport.SMTP.GetInstance(creds); transport.Deliver(message); BlogDb.GetTable<EmailVerification>().InsertOnSubmit(invite); BlogDb.SubmitChanges(); }
partial void DeleteEmailVerification(EmailVerification instance);
partial void InsertEmailVerification(EmailVerification instance);
partial void UpdateEmailVerification(EmailVerification instance);
private void detach_EmailVerifications(EmailVerification entity) { this.SendPropertyChanging(); entity.User = null; }