private void BindEmailReceiver(string eventName) { Transform box = ReceiverBinder.BindReceiveEvent(eventName, tran => { Debug.LogFormat("{0} box receive a Email.", tran.name); GameObject email = Instantiate(ResLoader.Instance.LoadResFromResFile <GameObject> ("Email", true)); email.transform.SetParent(tran, false); int emailId = GameDefine.emailId++; email.name = "emailId_" + emailId; //应放在服务端发送数据到客户端 EmailStruct emailData = new EmailStruct(); emailData.emailId = emailId; emailData.senderHead = ResLoader.Instance.LoadResFromResFile <Sprite> ("Sprite/head1", true); emailData.attachImg = ResLoader.Instance.LoadResFromResFile <Sprite> ("Sprite/item" + Random.Range(0, 4), true); emailData.senderId = "System" + Random.Range(1, 10); emailData.content = "系统奖励:" + Random.Range(10, 20); emailData.state = "剩余时间"; emailData.Timer = Random.Range(20, 30).ToString(); MessageDispatcher.RegisterModel(email.name, emailData); }); if (box != null) { _emailBoxList.Add(box); } }
// Adds new mail into the JSON file so it appears in the inbox. public static void AddMail(string src, string dst, string dt, string sbjt, string bdy) { string domain = "";//init if (BootOptions.enableNetworking == true) { //break up parts of the sender's email if (src.Contains("@")) { string[] breakUpEmail = src.Split('@'); domain = breakUpEmail[1]; //grab domain after the @ symbol } //If the email source hasn't been blocked on the firewall if (Class_Firewall.blockedDomains.Contains(domain) == false) { EmailStruct newMail = new EmailStruct { // Creates a new email with the passed in values. Source = src, Destination = dst, Date = dt, Subject = sbjt, Body = bdy }; //Then we add the new email to the inbox. EmailList.Add(newMail); Desktop_BKEND.Notification("You've got mail!"); } } }
public ActionResult <VerificationStruct> GetVerifyEmail(string login) { var lastemail = (from user in context.Users where user.Login == login join email in context.Emails on user.UserId equals email.UserId orderby email.Time descending select email).ToList()[0]; if (lastemail.Verified) { return(new VerificationStruct() { Answer = false, Message = new Dictionary <string, string>() { ["Message"] = "Already verified." } }); } else { var emailtoverif = new EmailStruct(lastemail); emailtoverif.Verify(context); return(new VerificationStruct() { Answer = true, Message = new Dictionary <string, string>() { ["Message"] = "Code was send on email." } }); } }
static void Main(string[] args) { Configuration.ApiKey = "api_key"; PepipostClient client = new PepipostClient(); MailSendController mailSend = client.MailSend; Send body = new Send(); body.From = new From(); body.From.Email = "*****@*****.**"; body.From.Name = "Pepipost"; body.Subject = "Pepipost Test Mail from SDK"; body.Content = new List <Content>(); Content body_content_0 = new Content(); body_content_0.Type = TypeEnum.HTML; body_content_0.Value = "<html><body>Hello, Welcome to Pepipost Family.<br>My name is [% name %].<br>my love is sending [% love %]</body> <br></html>"; body.Content.Add(body_content_0); body.Personalizations = new List <Personalizations>(); Personalizations body_personalizations_0 = new Personalizations(); body_personalizations_0.Attributes = APIHelper.JsonDeserialize <Object>("{\"name\":\"Pepi\",\"love\":\"Email\"}"); body_personalizations_0.Attachments = new List <Attachments>(); Attachments body_personalizations_0_attachments_0 = new Attachments(); body_personalizations_0_attachments_0.Content = "SGVsbG8sIHRoaXMgZmlsZSBpcyBhbiBpbmZvcm1hdGlvbmFsIGZpbGU6OiBTZW5kaW5nIGVtYWlscyB0byB0aGUgaW5ib3ggaXMgd2hhdCB3ZSBkbywgYnV0IHRoYXTigJlzIG5vdCB0aGUgb25seSByZWFzb24gd2h5IGRldmVsb3BlcnMgYW5kIGVudGVycHJpc2VzIGxvdmUgdXMuIFdlIGFyZSB0aGUgb25seSBFU1AgdGhhdCBkb2VzbuKAmXQgY2hhcmdlIGZvciBlbWFpbHMgb3BlbmVkLg=="; body_personalizations_0_attachments_0.Name = "personalized-file.txt"; body_personalizations_0.Attachments.Add(body_personalizations_0_attachments_0); body_personalizations_0.To = new List <EmailStruct>(); EmailStruct body_personalizations_0_to_0 = new EmailStruct(); body_personalizations_0_to_0.Name = "Vikram Sahu"; body_personalizations_0_to_0.Email = "*****@*****.**"; body_personalizations_0.To.Add(body_personalizations_0_to_0); body_personalizations_0.Cc = new List <EmailStruct>(); body_personalizations_0.Bcc = new List <EmailStruct>(); body.Personalizations.Add(body_personalizations_0); body.Tags = new List <string>(); body.Tags.Add("campaign"); const string dynamicURL = "https://api.pepipost.com"; //(pass if any other url is suggested) try { object result = mailSend.CreateGeneratethemailsendrequestAsync(body, dynamicURL).Result; Console.WriteLine(result); } catch (APIException e) { }; }
public bool SendEmail(EmailStruct estruct) { try { if (!bSMTPInitialized) { throw new Exception("Error: SMTP Not initialized"); } MailMessage message = new MailMessage(estruct.SenderEmail, estruct.ReceiverEmail, estruct.EmailTitle, estruct.EmailBody); emailClient.Send(message); return(true); } catch (Exception ex) { _logger.LogItem("EmailService SendEmail() To - email send failed: " + ex.Message); return(false); } }
private void Start() { ButtonTriggerListener listen = ButtonTriggerListener.GetListener(getBtn); listen.onClick = go => { GetEmail(); }; MessageDispatcher.AddListner(transform.name, o => { EmailStruct email = (EmailStruct)o; senderHead.sprite = email.senderHead; AttachImg.sprite = email.attachImg; senderId.text = email.senderId; content.text = email.content; state.text = email.state; timer.text = email.Timer; }); }
public bool SendEmailHTML(EmailStruct estruct) { try { if (!bSMTPInitialized) { throw new Exception("Error: SMTP Not initialized"); } MailMessage message = new MailMessage(estruct.SenderEmail, estruct.ReceiverEmail, estruct.EmailTitle, estruct.EmailBody.Replace(Environment.NewLine, "<br/>")); message.IsBodyHtml = true; emailClient.UseDefaultCredentials = false; emailClient.Credentials = SMTPUserInfo; emailClient.Send(message); return(true); } catch (Exception ex) { _logger.LogItem("EmailService SendEmailHTML 2() To - email send failed: " + ex.Message); return(false); } }
/// <summary> /// Thread para envio de email /// </summary> /// <param name="emailStruct">EmailStruct</param>s private void ThreadExecuteAsync(EmailStruct email) { new Thread(() => { SmtpClient smtpClient = _emailSettings.SmtpClient; MailAddress from = new MailAddress(_emailSettings.From, _emailSettings.Alias, _emailSettings.TextEncoding); MailAddress to = new MailAddress(email.To); MailMessage mailMessage = new MailMessage(from, to); smtpClient.SendCompleted += new SendCompletedEventHandler(EmailCallbackAsync); mailMessage.SubjectEncoding = _emailSettings.TextEncoding; mailMessage.BodyEncoding = _emailSettings.TextEncoding; mailMessage.IsBodyHtml = _emailSettings.IsBodyHtml; mailMessage.Subject = email.Subject; mailMessage.Body = email.Body; string token = email.To; _semaphore.WaitOne(); smtpClient.SendAsync(mailMessage, token); }).Start(); }