我要写个方法,就是调用一个邮箱,把指定的文件发送到另一个邮箱,
就是用这个方法实现发邮件的,我是新学asp,希望大家给个思路,详细为好,谢谢!
就是用这个方法实现发邮件的,我是新学asp,希望大家给个思路,详细为好,谢谢!
解决方案 »
- excel导入时间日期格式问题
- 关于工行B2C 接口版本1.0.0.11 在线支付的问题
- asp.net detailsview或者gridview的问题
- GridView里 无法将linkbutton 的对象强制转换为类型 button 的问题
- 请大家看看这是什么错误?关于窗体验证
- 将数据绑定到DropDownList,选择一个条目后如何获取它的值?
- 毕业设计是个网上选课系统。下到了了一堆aspx。aspx。cs
- 如何取得一个数据库里面相同记录的个数
- 免费菜单控件下载 (LuckBugMenu for Asp.net)
- 为什么在aspx页面加入void Page_Load()事件不执行?
- 数据查询的问题
- 一个带参跳转的问题,急!!!!!
objMail.From = "[email protected]" ' The email address of the recipient
objMail.To = "[email protected]" ' The email address of the Cc recipient
objMail.Cc = "[email protected]" ' The email address of the Bcc recipient
objMail.Bcc = "[email protected]" ' The format of the message - it can be MailFormat.Text
or MailFormat.Html
objMail.BodyFormat = MailFormat.Text ' The priority of the message - it can be MailPriority.High,
MailPriority,Normal or MailPriority.Low
objMail.Priority = MailPriority.High 'The subject of the message
objMail.Subject = "My first ASP.NET email" 'The message text
objMail.Body = "This is my first email sent via
ASP.NET. It was easier than I thought :)"After all the properties (some of them are optional) of our new email message are set properly, the only thing that's left to do is send the message. 3. Send the MessageIf you have experience sending email from classic ASP script with CDONTS you might think that the MailMessage class has method Send or something similar. Well, the way ASP.NET sends email messages is a little different from ASP. We need to use the static method Send of the SmtpMail class, passing in our objMail instance. You might be asking "what's a 'static method'?" A static method is one that's not associated with an instance of a type. An example of an instance of a type is our objMail object. It is illegal to reference a static member of a class through an instance. The proper way to do it is:SmtpMail.Send(objMail)If you want to specify an SMTP server that's different than the default, you'll need to set the SmtpServer property of the SmtpMail class:SmtpMail.SmtpServer = "smtp.your-server.com"
上google一搜一大堆
http://www.mycodes.net/soft/10393.htm
http://www.onlinedown.net/soft/30337.htm
string MS = "nihao";
string MB = "body";
Sendmail(MT,MS,MB);
private void Sendmail(string MessageTo, string MessageSubject, string MessageBody)
{
MailMessage message = new MailMessage();
message.From = "[email protected]";
message.To = MessageTo;
message.Subject = MessageSubject;
message.BodyFormat = MailFormat.Text;
message.Priority = MailPriority.High; //优先级
message.Body = MessageBody;
SmtpMail.SmtpServer = "";
SmtpMail.Send(message);
}
我这个运行没错误,但是也发不了,有什么问题吗