Esempio n. 1
0
 private byte[] GetPayload()
 {
     return(BitConverter.GetBytes(ProtocolVersion)
            .Concat(BitConverter.GetBytes(Services))
            .Concat(BitConverter.GetBytes(Timestamp))
            .Concat(RecipientAddress.ToBytes())
            .Concat(SenderAddress.ToBytes())
            .Concat(BitConverter.GetBytes(Nonce))
            .Concat(UserAgentLength.ToBytes())
            .Concat(Encoding.ASCII.GetBytes(UserAgent))
            .Concat(BitConverter.GetBytes(StartHeight))
            .Concat(Relay ? new byte[] { 0x01 } : new byte[] { 0x00 })
            .ToArray());
 }
    public override int GetHashCode()
    {
        int hash = 1;

        if (senderAddress_ != null)
        {
            hash ^= SenderAddress.GetHashCode();
        }
        if (CurrentIndex != 0L)
        {
            hash ^= CurrentIndex.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
    public override int GetHashCode()
    {
        int hash = 1;

        if (senderAddress_ != null)
        {
            hash ^= SenderAddress.GetHashCode();
        }
        if (Xml.Length != 0)
        {
            hash ^= Xml.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
 public void MergeFrom(DeltaRequest other)
 {
     if (other == null)
     {
         return;
     }
     if (other.senderAddress_ != null)
     {
         if (senderAddress_ == null)
         {
             SenderAddress = new global::ServerAddressMessage();
         }
         SenderAddress.MergeFrom(other.SenderAddress);
     }
     if (other.CurrentIndex != 0L)
     {
         CurrentIndex = other.CurrentIndex;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
 public void MergeFrom(ChainMessage other)
 {
     if (other == null)
     {
         return;
     }
     if (other.senderAddress_ != null)
     {
         if (senderAddress_ == null)
         {
             SenderAddress = new global::ServerAddressMessage();
         }
         SenderAddress.MergeFrom(other.SenderAddress);
     }
     if (other.Xml.Length != 0)
     {
         Xml = other.Xml;
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Esempio n. 6
0
 public void Main(string sender, string receiver)
 {
     SenderAddress   = SenderAddress;
     ReceiverAddress = ReceiverAddress;
     if (CheckRequiredFields())
     {
         using (var client = new AmazonSimpleEmailServiceClient(AwsAccessKeyId, AwsSecretAccessKey, EndPoint))
         {
             CloneReceiptRule(client);
             UpdateReceiptRule(client, SenderAddress);
             CreateEmail(client, SenderAddress);
             CreateReceiptRuleSet(client, SenderAddress);
             CreateBucket(SenderAddress.Replace("@", "-").Replace(".", "-"));
             CreateReceiptRule(client, SenderAddress);
             GetAllVerifiedEmail(client);
             //VerifyEmailAddress(client, SenderAddress);
             SendEmail(client);
             SendEmailWithAttachments(client);
             SendSmtpEmail();
         }
     }
     Console.Write("Press any key to continue...");
     Console.ReadKey();
 }
Esempio n. 7
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 14, Configuration.FieldSeparator),
                       Id,
                       SenderOrganizationName?.ToDelimitedString(),
                       SenderIndividualName != null ? string.Join(Configuration.FieldRepeatSeparator, SenderIndividualName.Select(x => x.ToDelimitedString())) : null,
                       SenderAddress != null ? string.Join(Configuration.FieldRepeatSeparator, SenderAddress.Select(x => x.ToDelimitedString())) : null,
                       SenderTelephone != null ? string.Join(Configuration.FieldRepeatSeparator, SenderTelephone.Select(x => x.ToDelimitedString())) : null,
                       SenderEventIdentifier?.ToDelimitedString(),
                       SenderSequenceNumber.HasValue ? SenderSequenceNumber.Value.ToString(Consts.NumericFormat, culture) : null,
                       SenderEventDescription != null ? string.Join(Configuration.FieldRepeatSeparator, SenderEventDescription) : null,
                       SenderComment,
                       SenderAwareDateTime.HasValue ? SenderAwareDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventReportDate.HasValue ? EventReportDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       EventReportTimingType != null ? string.Join(Configuration.FieldRepeatSeparator, EventReportTimingType) : null,
                       EventReportSource,
                       EventReportedTo != null ? string.Join(Configuration.FieldRepeatSeparator, EventReportedTo) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Esempio n. 8
0
        public bool Send()
        {
            using (MailMessage mailMessage = new MailMessage(SenderAddress, RecieverAddress))
            {
                mailMessage.Subject = MailSubject;
                mailMessage.Body    = MailBody;
                //check if there are attachments
                if (MailAttachments.Count > 0)
                {
                    foreach (var item in MailAttachments)
                    {
                        //loop through each attachments
                        mailMessage.Attachments.Add(new Attachment(item));
                    }
                }

                mailMessage.IsBodyHtml = true;

                //create Smtp client
                SmtpClient smtp = new SmtpClient();

                //to determine the sender host, we check which email service provider the sender address is using
                string[] host = SenderAddress.Split('@');
                smtp.Host = null;
                switch (host[1])
                {
                case "gmail.com":
                    smtp.Host = "smtp.gmail.com";
                    break;

                case "yahoo.com":
                    smtp.Host = "smtp.mail.yahoo.com";
                    break;

                case "live.com":
                    smtp.Host = "smtp.live.com";
                    break;

                default:
                    break;
                }
                smtp.Port                  = 587;
                smtp.EnableSsl             = true;
                smtp.UseDefaultCredentials = false;
                smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;

                NetworkCredential networkCredential = new NetworkCredential(SenderAddress, Password);
                smtp.Credentials = networkCredential;



                try
                {
                    smtp.Send(mailMessage);
                    return(true);
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message.ToString());
                }
            }
        }
Esempio n. 9
0
 get => new Email(
     FluentEmail.Core.Email.DefaultRenderer,
     _sender,
     SenderAddress,
     SenderName);
Esempio n. 10
0
 // SenderAddress
 public Task <SenderAddress> CreateorUpdateSenderAddressAsync(ConnectorCredential credential, EmailAccount emailAccount, SenderAddress senderAddress, CancellationToken cancellationToken)
 {
     return(this.connector.CreateorUpdateSenderAddressAsync(credential, emailAccount, senderAddress, cancellationToken));
 }
Esempio n. 11
0
        public virtual void Send(string theme, string message, string attachmentPath, int variant)
        {
            if (SenderAddress.Contains("yandex.ru") || SenderAddress.Contains("ya.ru"))
            {
                if (variant == 0) //отправить одно сообщение на адрес из поля
                {
                    MailMessage mailmes = new MailMessage(SenderAddress, GetterAddress);
                    mailmes.IsBodyHtml = true;
                    mailmes.Subject    = theme;
                    mailmes.Body       = message;
                    ForYandex(mailmes);
                }

                if (variant == 1) // отправить сообщение на адреса из списка
                {
                    foreach (var item in Addresses)
                    {
                        MailMessage mailmes = new MailMessage(SenderAddress, item.ToString());

                        mailmes.IsBodyHtml = true;
                        mailmes.Subject    = theme;
                        mailmes.Body       = message;
                        ForYandex(mailmes);
                    }
                }

                if (variant == 2) //отправить на адрес из поля и на адреса из списка
                {
                    MailMessage mailmes = new MailMessage(SenderAddress, GetterAddress);
                    mailmes.IsBodyHtml = true;
                    mailmes.Subject    = theme;
                    mailmes.Body       = message;
                    ForYandex(mailmes);

                    foreach (var item in Addresses)
                    {
                        mailmes = new MailMessage(SenderAddress, item.ToString());

                        mailmes.IsBodyHtml = true;
                        mailmes.Subject    = theme;
                        mailmes.Body       = message;
                        ForYandex(mailmes);
                    }
                }
            }

            if (SenderAddress.Contains("mail.ru"))
            {
                if (variant == 0) //отправить одно сообщение на адрес из поля
                {
                    try
                    {
                        MailMessage mailmes = new MailMessage(SenderAddress, GetterAddress);
                        mailmes.IsBodyHtml = true;
                        mailmes.Subject    = theme;
                        mailmes.Body       = message;
                        if (attachmentPath != "")
                        {
                            mailmes.Attachments.Add(new Attachment(attachmentPath));
                        }
                        ForMailRu(mailmes);
                    }
                    catch (Exception ex)
                    {
                        Stats.bad++;
                        Stats.Errors.Add(ex.Message);
                    }
                }

                if (variant == 1) // отправить сообщение на адреса из списка
                {
                    try
                    {
                        foreach (var item in Addresses)
                        {
                            MailMessage mailmes = new MailMessage(SenderAddress, item.ToString());
                            mailmes.IsBodyHtml = true;
                            mailmes.Subject    = theme;
                            mailmes.Body       = message;
                            if (attachmentPath != "")
                            {
                                mailmes.Attachments.Add(new Attachment(attachmentPath));
                            }
                            ForMailRu(mailmes);
                        }
                    }
                    catch (Exception ex)
                    {
                        Stats.bad++;
                        Stats.Errors.Add(ex.Message);
                    }
                }

                if (variant == 2) //отправить на адрес из поля и на адреса из списка
                {
                    try
                    {
                        MailMessage mailmes = new MailMessage(SenderAddress, GetterAddress);
                        mailmes.IsBodyHtml = true;
                        mailmes.Subject    = theme;
                        mailmes.Body       = message;
                        if (attachmentPath != "")
                        {
                            mailmes.Attachments.Add(new Attachment(attachmentPath));
                        }
                        ForMailRu(mailmes);

                        foreach (var item in Addresses)
                        {
                            mailmes            = new MailMessage(SenderAddress, item.ToString());
                            mailmes.IsBodyHtml = true;
                            mailmes.Subject    = theme;
                            mailmes.Body       = message;
                            if (attachmentPath != "")
                            {
                                mailmes.Attachments.Add(new Attachment(attachmentPath));
                            }
                            ForMailRu(mailmes);
                        }
                    }
                    catch (Exception ex)
                    {
                        Stats.bad++;
                        Stats.Errors.Add(ex.Message);
                    }
                }
            }
        }