程序和邮件之间是怎么挂接的? 程序和邮件之间是怎么挂接的? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.Mail;namespace MailSender{ public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { MailMessage objMailMessage; MailAttachment objMailAttachment; // 创建一个附件对象 objMailAttachment = new MailAttachment("C:\\1.xml");//发送邮件的附件 // 创建邮件消息 objMailMessage = new MailMessage(); objMailMessage.From = "[email protected]";//源邮件地址 objMailMessage.To = "********@qq.com";//目的邮件地址 objMailMessage.Subject = "邮件发送标题:你好";//发送邮件的标题 objMailMessage.Body = "邮件发送标内容:测试一下是否发送成功!";//发送邮件的内容 objMailMessage.Attachments.Add(objMailAttachment);//将附件附加到邮件消息对象中 //接着利用sina的SMTP来发送邮件,需要使用Microsoft .NET Framework SDK v1.1和它以上的版本 //基本权限 objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //用户名 objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "mytest110"); //密码 objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "******"); //如果没有上述三行代码,则出现如下错误提示:服务器拒绝了一个或多个收件人地址。服务器响应为:530 Authentication required //SMTP地址 SmtpMail.SmtpServer = "smtp.sina.com"; // 开始发送邮件 // 在发送之前,去新浪邮箱里开启POP/SMTP设置 邮箱设置->账户->POP/SMTP设置->开启 // 否则会报错误0x80040217. The server response was not available SmtpMail.Send(objMailMessage); } }} jb51里一个强大的照相机问题 页面点的次数多了就报错。 如何遍历控件(checkbox ) 请大家进来看看,我写的这段程序有什么问题 GridView 怎么实现页脚 :(共几条记录,共几页 第几页) 关于html的问题 如何开发类似网络电台的系统 这段代码哪里出错了呢? c# 怎么让两张图片叠加啊? 我想用asp.net(vb)&sql开发一个公司的仓库管理系统不知有什么不足的地方 正则表达式 Form表单action提交
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Mail;namespace MailSender
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ } protected void Button1_Click(object sender, EventArgs e)
{
MailMessage objMailMessage;
MailAttachment objMailAttachment; // 创建一个附件对象
objMailAttachment = new MailAttachment("C:\\1.xml");//发送邮件的附件 // 创建邮件消息
objMailMessage = new MailMessage();
objMailMessage.From = "[email protected]";//源邮件地址
objMailMessage.To = "********@qq.com";//目的邮件地址
objMailMessage.Subject = "邮件发送标题:你好";//发送邮件的标题
objMailMessage.Body = "邮件发送标内容:测试一下是否发送成功!";//发送邮件的内容
objMailMessage.Attachments.Add(objMailAttachment);//将附件附加到邮件消息对象中 //接着利用sina的SMTP来发送邮件,需要使用Microsoft .NET Framework SDK v1.1和它以上的版本
//基本权限
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //用户名
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "mytest110"); //密码
objMailMessage.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "******"); //如果没有上述三行代码,则出现如下错误提示:服务器拒绝了一个或多个收件人地址。服务器响应为:530 Authentication required //SMTP地址
SmtpMail.SmtpServer = "smtp.sina.com"; // 开始发送邮件
// 在发送之前,去新浪邮箱里开启POP/SMTP设置 邮箱设置->账户->POP/SMTP设置->开启
// 否则会报错误0x80040217. The server response was not available
SmtpMail.Send(objMailMessage);
}
}
}