send Email with asp.net
2006-01-18 09:59
323 查看
这几天做到发送邮件的功能,代码如下:
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
中间出现过could not access 'cdo.message' object 异常。
后来检查发送的验证不通过导致的
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "you@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
中间出现过could not access 'cdo.message' object 异常。
后来检查发送的验证不通过导致的
相关文章推荐
- Send Email and Attachments with ASP.Net...
- ASP.NET how to send data with post method?
- Send mail with attachment in asp.net
- asp.net 错误提示:Could not load type 'SendEmail.WebPage'
- ASP.NET Send Email
- Working with Windows Workflow Foundation in ASP.NET
- How to Send an Email Using UTL_SMTP with Authenticated Mail Server
- ASP.NET结合COM组件发送Email
- Client Ids generation with ASP.NET 4.0
- [转]Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package
- http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application
- ASP.NET操作EXCEL时出现的错误 Retrieving the COM class factory for component with CLSID
- Exchange Server Mail server with asp.NET 1st step
- Security Measure To Prevent URL Parameter Forgery- An Example with ASP.Net MVC
- AS.NET2.0 用户控件错误!!The base class includes the field 'MyControl_1', but its type (MyControl) is not compatible with the type of control (ASP.MyControl_ascx).
- ASP.NET MVC 3: Server-Side Comments with Razor
- 【ASP.NET Step by STep】之九 Master/Detail Filtering Across Two Pages 之十 Master/Detail Using a Selectable Master GridView with a Details DetailView
- User Authentication with Angular and ASP.NET Core
- Debugging ASP.NET MVC applications with Glimpse
- ASP.NET Web Development with Macromedia Dreamweaver MX 2004