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


C# Email.Send方法代码示例

本文整理汇总了C#中Postal.Email.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Email.Send方法的具体用法?C# Email.Send怎么用?C# Email.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Postal.Email的用法示例。


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

示例1: Send

        public void Send(string content)
        {
            _smtpClient = new SmtpClient(Address, Port);
            _smtpClient.Credentials = new NetworkCredential(Account, Password);
            _smtpClient.EnableSsl = false;
            MailMessage mailMessage = new MailMessage();
            mailMessage.BodyEncoding = Encoding.UTF8;
            mailMessage.From = new MailAddress(From, SenderName, Encoding.UTF8);
            mailMessage.To.Add(To);
            mailMessage.Body = content;
            mailMessage.Subject = Subject;
            _smtpClient.Send(mailMessage);


            dynamic email = new Email("Example");
            email.To = "[email protected]";
            email.Send();


            var viewsPath = Path.GetFullPath(@"..\..\Views");

            var engines = new ViewEngineCollection();
            engines.Add(new FileSystemRazorViewEngine(viewsPath));

            var service = new EmailService(engines);
            dynamic email = new Email("Test");

            // Will look for Test.cshtml or Test.vbhtml in Views directory.
            email.Message = "Hello, non-asp.net world!";
            service.Send(email);
           // RESTORE DATABASE is terminating abnormally.
        }
开发者ID:ilkerhalil,项目名称:ZiylanEtl,代码行数:32,代码来源:Mailer.cs

示例2: Contact

        public ActionResult Contact(ContactModel model)
        {
            // Build the contact email using a dynamic object for flexibility
            dynamic email = new Email("Contact");
            email.To = ConfigurationManager.AppSettings["email:ContactToAddress"];
            email.From = ConfigurationManager.AppSettings["email:ContactFromAddress"];
            email.FirstName = model.FirstName;
            email.LastName = model.LastName;
            email.BusinessType = model.BusinessType;
            email.AddressLine1 = model.AddressLine1;
            email.AddressLine2 = model.AddressLine2;
            email.City = model.City;
            email.State = model.State;
            email.ZipCode = model.ZipCode;
            email.Country = model.Country == "Other" ? model.CountryName : model.Country;
            email.Phone = model.Phone;
            email.Email = model.Email;
            email.Comments = model.Comments;
            email.Send();

            // Set the ShowThanksMessage flag to provide user feedback on the page.
            model.ShowThanksMessage = true;

            return View(model);
        }
开发者ID:jrhines,项目名称:lafayette-testing-services,代码行数:25,代码来源:HomeController.cs

示例3: NotifyTaskOwner

        public static void NotifyTaskOwner(ContractTask task)
        {
            dynamic email = new Email("NotificationMail");
            email.to = task.User.Email;
            email.from = applicationEmail;

            email.Send();
        }
开发者ID:R-Carver,项目名称:Code-fueMoses,代码行数:8,代码来源:MailUtility.cs

示例4: NotifyOnEscalation

        public static void NotifyOnEscalation(ContractTask task, string contractOwnerEmail)
        {
            dynamic email = new Email("EscalationMail");
            email.to = contractOwnerEmail;
            email.from = applicationEmail;

            email.Send();
        }
开发者ID:R-Carver,项目名称:Code-fueMoses,代码行数:8,代码来源:MailUtility.cs

示例5: SendHKNews

        public static bool SendHKNews(HKNewsPaper paper)
        {
            dynamic email = new Email("~/MailTemplates/HKNews.cshtml");
            email.Model = paper;
            email.Send();

            return true;
        }
开发者ID:hurtonypeter,项目名称:onlab,代码行数:8,代码来源:MailHelper.cs

示例6: WelcomeSendPassword

 public static void WelcomeSendPassword(string username, string toaddress, string pass)
 {
     dynamic email = new Email("~/MailTemplates/Teszt.cshtml");
     email.To = toaddress;
     email.UserName = username;
     email.Password = pass;
     email.Send();
 }
开发者ID:hurtonypeter,项目名称:onlab,代码行数:8,代码来源:MailHelper.cs

示例7: SendSimple

        public ActionResult SendSimple()
        {
            dynamic email = new Email("Simple");
            email.Date = DateTime.UtcNow.ToString();
            email.Send();

            return RedirectToAction("Sent", "Home");
        }
开发者ID:Choulla-Naresh8264,项目名称:postal,代码行数:8,代码来源:EmailController.cs

示例8: QueueEmail

 public void QueueEmail(EmailViewModel emailViewModel)
 {
     dynamic email = new Email("SignUp");
     email.To = emailViewModel.To;
     email.ActivationToken = emailViewModel.ActivationToken;
     email.BaseDomain = configuration.BaseDomain;
     email.Send();
 }
开发者ID:naeemsarfraz,项目名称:GiveCRM.Admin,代码行数:8,代码来源:SignUpNonQueueingService.cs

示例9: ForgotThePassword

        public ActionResult ForgotThePassword(LoginViewModel loginModel)
        {
            dynamic email = new Email("ForgotThePassword");
            email.To = "[email protected]";
            email.FunnyLink = "Hello Alex :)";
            email.Send();

            return View();
        }
开发者ID:AlexKrainov,项目名称:TourForEverybuddy,代码行数:9,代码来源:EmailsController.cs

示例10: Index

 // GET: Home
 public ActionResult Index()
 {
     dynamic email = new Email("Example");
     email.To = "[email protected], [email protected], [email protected]";
     email.FunnyLink = "http://blog.respag.net";
     email.Fecha = DateTime.Now.ToString(@"dddd, dd \de MMMM \de yyyy");
     email.Send();
     return View();
 }
开发者ID:respag,项目名称:PostalExample,代码行数:10,代码来源:HomeController.cs

示例11: ResetUserPassword

 public JsonResult ResetUserPassword(string username, string emailAddress)
 {
     var confirmationToken = WebSecurity.GeneratePasswordResetToken(username);
     dynamic email = new Email("ChngPasswordEmail");
     email.To = emailAddress;
     email.UserName = username;
     email.ConfirmationToken = confirmationToken;
     email.Send();
     return Json(new { success = true });
 }
开发者ID:nancy-bree,项目名称:CreativeFactory,代码行数:10,代码来源:AdminController.cs

示例12: Contact

 public ActionResult Contact(string name, string useremail, string title, string message)
 {
     dynamic email = new Email("Contact");
     email.From = useremail;
     email.Name = name;
     email.Title = title;
     email.Message = message;
     email.Send();
     return View();
 }
开发者ID:sonnylegreat,项目名称:ThrowdownAttire,代码行数:10,代码来源:HomeController.cs

示例13: Send_creates_EmailService_and_calls_Send

        public void Send_creates_EmailService_and_calls_Send()
        {
            var emailService = new Mock<IEmailService>();
            Email.CreateEmailService = () => emailService.Object;
            var email = new Email("Test");

            email.Send();

            emailService.Verify(s => s.Send(email));
        }
开发者ID:Choulla-Naresh8264,项目名称:postal,代码行数:10,代码来源:EmailTests.cs

示例14: SendAsync

        public Task SendAsync(IdentityMessage message)
        {
            dynamic email = new Email("AuthEmail");
            email.To = message.Destination;
            email.Body = message.Body;
            email.Subject = message.Subject;

            email.Send();

            return Task.FromResult(0);
        }
开发者ID:Maxime-Antoine,项目名称:Bouchon.API,代码行数:11,代码来源:AuthMailService.cs

示例15: RegistrationConfirmationEmail

 public static void RegistrationConfirmationEmail(RegistrationConfirmationEmail input)
 {
     dynamic email = new Email("RegistrationConfirmation");
     email.To = input.To;
     email.From = input.From;
     email.Subject = input.Subject;
     email.Cc = input.Cc;
     email.Bcc = input.Bcc;
     email.ConfirmationLink = input.ConfirmationLink;
     email.FullName = input.FullName;
     email.Send();
 }
开发者ID:amihalj,项目名称:ipma,代码行数:12,代码来源:EmailUtils.cs


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