当前位置: 首页>>代码示例>>C#>>正文


C# Email类代码示例

本文整理汇总了C#中Email的典型用法代码示例。如果您正苦于以下问题:C# Email类的具体用法?C# Email怎么用?C# Email使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Email类属于命名空间,在下文中一共展示了Email类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendEmail

        public void SendEmail()
        {
            Email email = new Email() { To = "[email protected]", Subject = "Unit Test", DeliveryType ="Email", Message = "Test" };

            SendMail sendMail = new SendMail();
            Assert.IsTrue(sendMail.SendEmail(email));
        }
开发者ID:nVisionIT,项目名称:Moved-ProDev-D,代码行数:7,代码来源:EmailTest.cs

示例2: SendEmail

		public static void SendEmail(Email email)
		{
#if UNITY_IOS && !UNITY_EDITOR
			_opencodingConsoleBeginEmail(email.ToAddress, email.Subject, email.Message, email.IsHTML);
			foreach (var attachment in email.Attachments)
			{
				_opencodingConsoleAddAttachment(attachment.Data, attachment.Data.Length, attachment.MimeType, attachment.Filename);
			}
			_opencodingConsoleFinishEmail();
#elif UNITY_ANDROID && !UNITY_EDITOR
			AndroidJavaClass androidEmailClass = new AndroidJavaClass("net.opencoding.console.Email");
			
			androidEmailClass.CallStatic("beginEmail", email.ToAddress, email.Subject, email.Message, email.IsHTML);
			var emailAttachmentsDirectory = Path.Combine(Application.temporaryCachePath, "EmailAttachments");
			Directory.CreateDirectory(emailAttachmentsDirectory);
			foreach (var attachment in email.Attachments)
			{
				var attachmentPath = Path.Combine(emailAttachmentsDirectory, attachment.Filename);
				File.WriteAllBytes(attachmentPath, attachment.Data);
				androidEmailClass.CallStatic("addAttachment", attachmentPath);
			}

			androidEmailClass.CallStatic("finishEmail");
#else
			throw new InvalidOperationException("Emailing is not supported on this platform. Please contact [email protected] and I'll do my best to support it!");
#endif
		}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:27,代码来源:NativeMethods.cs

示例3: EmailToAccountMapQueryModel

        public EmailToAccountMapQueryModel(Email email, Guid accountId)
        {
            Contract.Argument(() => email, () => accountId).NotNullOrDefault();

            Email = email;
            AccountId = accountId;
        }
开发者ID:RichieYang,项目名称:Composable.Monolithic,代码行数:7,代码来源:EmailToAccountMapQueryModel.cs

示例4: HomeViewModel

        public HomeViewModel(ITelephonyService telephonyService = null, IScreen hostScreen = null)
        {
            TelephonyService = telephonyService ?? Locator.Current.GetService<ITelephonyService>();

            HostScreen = hostScreen ?? Locator.Current.GetService<IScreen>();

            var canComposeSMS = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
            ComposeSMS = ReactiveCommand.CreateAsyncTask(canComposeSMS,
                async _ => { await TelephonyService.ComposeSMS(Recipient); });
            ComposeSMS.ThrownExceptions.Subscribe(
                ex => UserError.Throw("Does this device have the capability to send SMS?", ex));

            var canComposeEmail = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
            ComposeEmail = ReactiveCommand.CreateAsyncTask(canComposeEmail, async _ =>
            {
                var email = new Email(Recipient);

                await TelephonyService.ComposeEmail(email);
            });
            ComposeEmail.ThrownExceptions.Subscribe(
                ex => UserError.Throw("The recipient is potentially not a well formed email address.", ex));

            var canMakePhoneCall = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
            MakePhoneCall = ReactiveCommand.CreateAsyncTask(canMakePhoneCall,
                async _ => { await TelephonyService.MakePhoneCall(Recipient); });
            MakePhoneCall.ThrownExceptions.Subscribe(
                ex => UserError.Throw("Does this device have the capability to make phone calls?", ex));

            var canMakeVideoCall = this.WhenAny(x => x.Recipient, x => !string.IsNullOrWhiteSpace(x.Value));
            MakeVideoCall = ReactiveCommand.CreateAsyncTask(canMakeVideoCall,
                async _ => { await TelephonyService.MakeVideoCall(Recipient); });
            MakeVideoCall.ThrownExceptions.Subscribe(
                ex => UserError.Throw("Does this device have the capability to make video calls?", ex));
        }
开发者ID:Jurabek,项目名称:telephony,代码行数:34,代码来源:HomeViewModel.cs

示例5: MemberReport

        /// <summary>
        /// Report a member
        /// </summary>
        /// <param name="report"></param>
        public void MemberReport(Report report)
        {
            var sb = new StringBuilder();
            var email = new Email();

            sb.AppendFormat("<p>{2}: <a href=\"{0}\">{1}</a></p>",
                string.Concat(_settingsService.GetSettings().ForumUrl.TrimEnd('/'), report.Reporter.NiceUrl),
                report.Reporter.UserName,
                _localizationService.GetResourceString("Report.Reporter"));

            sb.AppendFormat("<p>{2}: <a href=\"{0}\">{1}</a></p>",
                string.Concat(_settingsService.GetSettings().ForumUrl.TrimEnd('/'), report.ReportedMember.NiceUrl),
                report.ReportedMember.UserName,
                _localizationService.GetResourceString("Report.MemberReported"));

            sb.Append($"<p>{_localizationService.GetResourceString("Report.Reason")}:</p>");
            sb.Append($"<p>{report.Reason}</p>");

            email.EmailTo = _settingsService.GetSettings().AdminEmailAddress;
            email.Subject = _localizationService.GetResourceString("Report.MemberReport");
            email.NameTo = _localizationService.GetResourceString("Report.Admin");

            email.Body = _emailService.EmailTemplate(email.NameTo, sb.ToString());
            _emailService.SendMail(email);
        }
开发者ID:lenwen,项目名称:mvcforum,代码行数:29,代码来源:ReportService.cs

示例6: CreateValidWorkEmail

 public Email CreateValidWorkEmail()
 {
     Email email = new Email();
     email.Address = "[email protected]";
     email.Type = EmailType.Work;
     return email;
 }
开发者ID:rdammkoehler,项目名称:C-TDDExamples,代码行数:7,代码来源:EmailFixture.cs

示例7: getEmailDataFromTable

        private static IEnumerable<Email> getEmailDataFromTable()
        {
            SqlCommand command = new SqlCommand(
                string.Format("SELECT Id as IdMail, EMail as SendTo, Theme as Topic, Text as Body FROM {0} WHERE Sended=0", TABLE_NAME),
                connection);
            SqlDataReader reader = command.ExecuteReader();
            List<Email> newMails = new List<Email>();

            while (reader.Read())
            {
                Email mail = new Email
                {
                    IdMail = reader["IdMail"].ToString().Trim(),
                    SendTo = reader["SendTo"].ToString().Trim(),
                    Topic = reader["Topic"].ToString().Trim(),
                    Body = reader["Body"].ToString().Trim()
                };

                Console.WriteLine("--- New e-mail ---");
                Console.WriteLine("SendTo: " + mail.SendTo);
                Console.WriteLine("Topic: " + mail.Topic);
                Console.WriteLine("Body: " + mail.Body);

                newMails.Add(mail);
            }
            reader.Close();

            return newMails;
        }
开发者ID:AramisIT,项目名称:DllExchange,代码行数:29,代码来源:Program.cs

示例8: DoAction

        public void DoAction(WFActivity activity)
        {
            this._activity = activity;
            _mail = new Email();
            foreach (KeyValuePair<string, WFUser> kvUser in activity.WFUsers)
            {
                string mailAddress = String.IsNullOrWhiteSpace(kvUser.Value.Email) ? "" : kvUser.Value.Email.Trim() + ";";
                if (kvUser.Value.IsKeyUser)
                {
                    toUser += kvUser.Value.DisplayName + ",";
                    toMail += mailAddress;
                }
                else if (kvUser.Value.IsApprover && !kvUser.Value.IsKeyUser)
                {
                    continue;
                }
                else
                {
                    ccMail += mailAddress;
                }
            }

            if (AccessControl.IsVendor())
            {
                toUser += AccessControl.CurrentLogonUser.Name + ",";
                toMail += string.IsNullOrEmpty(AccessControl.CurrentLogonUser.Email) ?
                    "" : AccessControl.CurrentLogonUser.Email.Trim() + ";";
            }

            SendMail();
        }
开发者ID:rivernli,项目名称:SGP,代码行数:31,代码来源:SendMailAction.cs

示例9: SendEmailAsync

        // Methods
        public Task SendEmailAsync(Email email)
        {
            return Task.Run(() =>
                {
                    try
                    {
                        MailMessage mail = new MailMessage
                        {
                            From = new MailAddress(email.From),
                            Subject = email.Subject,
                            Body = email.Body,
                            IsBodyHtml = true
                        };

                        mail.To.Add(email.To);

                        SmtpClient smtp = new SmtpClient
                        {
                            Host = authentication.Host,
                            Port = authentication.Port,
                            UseDefaultCredentials = false,
                            Credentials = new System.Net.NetworkCredential(authentication.UserName, authentication.Password),
                            EnableSsl = true
                        };

                        smtp.Send(mail);
                    }
                    catch
                    {
                    }
                }
            );
        }
开发者ID:jeddeh,项目名称:grande-travel,代码行数:34,代码来源:DefaultEmailService.cs

示例10: Send

 public void Send(Email email)
 {
     using (var mailMessage = CreateMailMessage(email))
     {
         _simpleEmailService.SendEmail(CreateSendEmailRequest(mailMessage));
     }
 }
开发者ID:spatialfiend,项目名称:Postal.AmazonSES,代码行数:7,代码来源:SimpleEmailService.cs

示例11: ValidateModel

        public static HttpResponseMessage ValidateModel(Email.Email model)
        {
            var response = new HttpResponseMessage();
            if (!model.DeliveryType.Trim().ToLower().Equals("email"))
            {
                response.StatusCode = HttpStatusCode.NotImplemented;
                response.ReasonPhrase = string.Format("The DeliveryType [{0}] is not implemented.", model.DeliveryType);
                Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(new Exception(string.Format("The DeliveryType [{0}] is not implemented.", model.DeliveryType))));
            }

            if (string.IsNullOrWhiteSpace(model.To))
            {
                response.ReasonPhrase = "The \"To\" value is required";
                response.StatusCode = HttpStatusCode.BadRequest;
            }

            if (string.IsNullOrWhiteSpace(model.Subject))
            {
                response.ReasonPhrase = "The \"Subject\" value is required";
                response.StatusCode = HttpStatusCode.BadRequest;
            }

            try
            {
                var mailAddress = new MailAddress(model.To);
            }
            catch (FormatException)
            {
                response.ReasonPhrase = "The \"To\" value is not a valid email address";
                response.StatusCode = HttpStatusCode.BadRequest;
            }
            return response;
        }
开发者ID:nVisionIT,项目名称:Moved-ProDev-D,代码行数:33,代码来源:ValidateEmail.cs

示例12: TestMethod1

        public void TestMethod1()
        {
            /*var res = ArticuloLogica.Instancia.ingresarBodega(1, "Bodega San Pedro", "123");
            var result = ArticuloLogica.Instancia.obtenerBodegas(1);
            var result = ArticuloLogica.Instancia.ingresarArticulo(1, "100213", "Lápices Mongol", "unidad", "Son chinos", Convert.FromBase64String(""), 1);*/
            //var res = ArticuloLogica.Instancia.obtenerArticulosBodega("Bodega San Pedro");
            var orden = new Documento() {
                Fecha1= System.DateTime.Now,
                IdSocio = 2,
                TipoDocumento = 1,
                TotalAI = 1300
            };
            var detalle = new DocumentoDetalle(){
                NumeroDocumento = 22,
                IdArticulo = 1,
                Cantidad = 10,
                Descripcion = "Lapices Mongol",
                IdBodega = 1,
                Impuesto = 13,
                Precio = 130,
                TipoDocumento = 1

            };
            Email email = new Email();
            email.EnviarCorreo("[email protected]", orden, detalle);
        }
开发者ID:jaalvarez92,项目名称:SIA-Proyecto2,代码行数:26,代码来源:UnitTest1.cs

示例13: Send

        public EmailSendAttempt Send(Email email)
        {
            email.Sender = email.Sender ?? Configuration.EmailSender;
            var attempt = new EmailSendAttempt
                  {
                      Date = DateTime.UtcNow,
                      Server = Smtp.Host,
                      Success = true,
                  };
            try
            {
                Smtp.Send(email.ToMailMessage());
                email.Sent = DateTime.UtcNow;
            }
            catch (Exception ex)
            {
                attempt.Success = false;
                attempt.Error = ex.Message;
            }

            email.Tenant = Tenant.Document.Id;
            email.AddAttempt(attempt);
            Emails.Save(email);
            return attempt;
        }
开发者ID:nicknystrom,项目名称:AscendRewards,代码行数:25,代码来源:EmailMessagingService.cs

示例14: ValidateEmail

 private bool ValidateEmail()
 {
     var email = new Email(_emailCandidate.Text);
     if(String.IsNullOrEmpty(_emailCandidate.Text)) _emailCandidate.SetError(GetString(Resource.String.field_not_fill), _errorDrawable);
     if(!email.IsValid ()) _emailCandidate.SetError(GetString(Resource.String.invalid_email), _errorDrawable);
     return email.IsValid ();
 }
开发者ID:bernardo-bruning,项目名称:AnalysiSkill,代码行数:7,代码来源:CadasterCandidateActivity.cs

示例15: CreateValidAltEmail

 public Email CreateValidAltEmail()
 {
     Email email = new Email();
     email.Address = "[email protected]";
     email.Type = EmailType.Alt;
     return email;
 }
开发者ID:rdammkoehler,项目名称:C-TDDExamples,代码行数:7,代码来源:EmailFixture.cs


注:本文中的Email类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。