解决方案 »
- ASP.NET 自动生成函数问题
- 一个System.Reflection.Assembly的奇怪问题
- 最近工作不忙,想学点新东西,各位进来给点意见!
- 关于存储过程的两个小问题,高手请进
- 我使用的NET2003 安装了一个TREEVIEW控件,发现出现了1.0.2.226和1.0.2.116 的不同!!!
- 如何将DATASET中的全部数据插入到一个数据库的表中
- 谁能给详细讲讲开发搜索引挚的原理...????或谁有这样的源代码????
- 导出导入excel,求高手指点,在不做完就要被抄啦,请高手帮忙
- 大量图片是从数据库调用还是具体存放路径查找并调用速度快?
- 晕,论坛出错
- DataBinder.Eval绑定中文+(%)问题 急急
- 请教LinkButton重复提交的问题
只要知道了对方的login页面的url,用户名和密码两个text的name的值,在加个submit按钮就能等了。
以下是登录163邮箱的代码:
<form action="http://reg.163.com/login.jsp" method="post>
<br/>
<input type="text" name="username"/>
<input type="text" name="password"/>
<input type="submit" value="submit"/>
</form>
{
private string _serverUrl;
private string _userName;
private string _userPwd;
private string _userUrl;
private string _receiveUrl;
private string _title;
private string _body; public string ServerUrl
{
get { return _serverUrl; }
set { _serverUrl = value; }
} public string UserName
{
get { return _userName; }
set { _userName = value; }
} public string UserPwd
{
get { return _userPwd; }
set { _userPwd = value; }
} public string UserUrl
{
get { return _userUrl; }
set { _userUrl = value; }
} public string ReceiveUrl
{
get { return _receiveUrl; }
set { _receiveUrl = value; }
} public string Title
{
get { return _title; }
set { _title = value; }
} public string Body
{
get { return _body; }
set { _body = value; }
} public void SendMail(SendEmail email)
{
//发送邮件,直接发送带有用户名,密码的邮件,因为密码没有加密。
System.Net.Mail.SmtpClient client = new SmtpClient(email.ServerUrl);
client.UseDefaultCredentials = false;
//下面的用户名密码填写自己在163的用户名密码,也可以修改上面的SMTP服务器
client.Credentials = new System.Net.NetworkCredential(email.UserName, email.UserPwd);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
//创建MailMessage对象,参数分别为 发件人地址,收件人地址 ,信件标题,信件正文
System.Net.Mail.MailMessage message = new MailMessage(email.UserUrl, email.ReceiveUrl, email.Title, email.Body);
message.BodyEncoding = System.Text.Encoding.Default; //编码
message.IsBodyHtml = true; //是否是HTML代码
try
{
client.Send(message); //发送
}
catch
{
}
}
}