private void SendMailExe() { MailMessage message = new MailMessage(); message.From = new MailAddress(_fromAddr); if (ToAll) { foreach (string addr in _allRecipientsList) { message.To.Add(addr); } if (!ToAddr.Equals("")) { message.To.Add(ToAddr); } } else { if (ToPreYear) { foreach (string addr in _preYearRecipientsList) { message.To.Add(addr); } if (!ToAddr.Equals("")) { message.To.Add(ToAddr); } } else { if (!ToAddr.Equals("")) { message.To.Add(ToAddr); } } } message.Subject = MailSubject; message.Body = MailBody; message.Attachments.Add(new Attachment(_attachFullPath)); _mailClient.Send(message); ClearSendMailExe(); }
private bool CanSendMail() { if (!ToAll && !ToPreYear) { if (ToAddr.Equals("")) { return(false); } else { try { var addr = new System.Net.Mail.MailAddress(ToAddr); return(addr.Address == ToAddr); } catch { return(false); } } } if (!ToAddr.Equals("")) { try { var addr = new System.Net.Mail.MailAddress(ToAddr); return(addr.Address == ToAddr); } catch { return(false); } } return(true); }
public byte[] Encode() { BigInteger amount = BigInteger.ValueOf(long.Parse(Amount)); BigInteger gasPrice = BigInteger.ValueOf(long.Parse(GasPrice)); ProtoTransactionInfo info = new ProtoTransactionInfo(); info.Version = (uint)Version; info.Nonce = (ulong)Nonce; info.Toaddr = ByteString.CopyFrom(ByteUtil.HexStringToByteArray(ToAddr.ToLower())); info.Senderpubkey = new ByteArray() { Data = ByteString.CopyFrom(ByteUtil.HexStringToByteArray(PubKey)) }; info.Amount = new ByteArray() { Data = ByteString.CopyFrom(BigIntegers.AsUnsignedByteArray(16, amount)) }; info.Gasprice = new ByteArray() { Data = ByteString.CopyFrom(BigIntegers.AsUnsignedByteArray(16, gasPrice)) }; info.Gaslimit = ulong.Parse(GasLimit); if (!string.IsNullOrEmpty(Code)) { info.Code = ByteString.CopyFrom(System.Text.Encoding.Default.GetBytes(Code)); } if (!string.IsNullOrEmpty(Data)) { info.Data = ByteString.CopyFrom(System.Text.Encoding.Default.GetBytes(Data)); } return(info.ToByteArray()); }