protected override void ConfigureSender(Message message) { if (!this.HasCredentials) { throw new Exception("Gmail Sender requires account email address and password for authentication"); } base.ConfigureSender(message); }
public static void UT() { GmailSender sender = new GmailSender( "*****@*****.**", "490410056"); sender.AsyncSend = true; Message message = new Message("*****@*****.**", "*****@*****.**", DateTime.Now.ToString(), "初中的體育老師說:誰敢再穿裙子上我的課,就罰她倒立"); message.Encoding = Encoding.UTF8; sender.Send(message); }
private void btnOK_Click(object o, EventArgs e) { string Email = tbEmail.Text; if (Email.Length == 0) throw new ArgumentNullException("Email"); if(false == JUtil.Validation.IsValidEmail(Email)) throw new Exception(String.Format("Email不符合正確格式({0})", Email)); string account = "*****@*****.**"; string passwd = "490410056"; string from = "*****@*****.**"; GmailSender sender = new GmailSender( account, passwd); sender.AsyncSend = true; string softwareName = string.Empty; StringBuilder sb = new StringBuilder(); foreach(License license in SelectedItemTags) { sb.AppendFormat("({0}) - {1}\r\n\r\n", license.comment, license.serialNumber); softwareName = license.softwareName; } string body = sb.ToString(); string title = string.Format("{0} 產品金鑰", softwareName); Message message = new Message(from, Email, title, body); message.Encoding = Encoding.UTF8; sender.Send(message); DialogResult = DialogResult.OK; }
public virtual void Send(Message[] messages) { }
public virtual void Send(Message message) { }