我想在asp.net(c#)中发送外部邮件,如何实现呢?请帮帮我 大家好,我在试用期内,领导让我实现如下功能,请大侠们一定帮忙!公司有个网站,要求作个邮箱,能够发送外部邮件,就是输入外部E_MAIL,比如输入:[email protected],能够发送到这个邮箱,请帮帮我呀!就这些分了,请大家不要见怪! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using System.Web.Mail;可以看一下!.NET自带的不过不怎么好!我用的是jmail 要下载一个安装文件http://www.mydown.com/code/115/115586.html使用http://www.blueidea.com/bbs/newsdetail.asp?id=1036923 C# 的(in C#) using System.Web.Mail; public void sendMail() { try { System.Web.Mail.MailMessage myMail=new MailMessage(); myMail.From = "[email protected]"; myMail.To = "[email protected]"; myMail.Subject = "MailTest"; myMail.Priority = MailPriority.Low; myMail.BodyFormat = MailFormat.Text; myMail.Body = "Test"; SmtpMail.SmtpServer="smarthost"; //your smtp server here SmtpMail.Send(myMail); } catch(Exception e) { throw e; } } http://www.cnblogs.com/goody9807/archive/2005/03/09/115367.html zhangguozhixp(飞翔的菜鸟)的代码是对的,但是建议加上发送者的邮箱的用户名和密码,也就是身份验证,不然很容易被当成垃圾邮件过滤掉。 ......//创建对象MailMessage myMail = new MailMessage();//发送服务器SmtpMail.SmtpServer="smtp.sina.com.cn";//认证myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");//用户名myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","luck");//密码myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","xxx");//收信人myMail.To=txtTo.Text.Trim();//收信人//寄信人myMail.From=txtFrom.Text.Trim();//主题myMail.Subject=txtTitle.Text.Trim();//内容myMail.Body=txtContent.Text;//正文格式myMail.BodyFormat=MailFormat.Text;//优先级myMail.Priority=MailPriority.High;//发送SmtpMail.Send(myMail);...... 建议采用Jmail,或CDOhttp://www.chinamacro.com/blog/visit_detail.aspx?blogID=13 MailMessage myMail = new MailMessage(); myMail.From="[email protected]"; myMail.To="[email protected]"; myMail.Subject="test"; myMail.BodyFormat = MailFormat.Html; myMail.Body="<html><body>test!test!</body></html>"; MailAttachment myAttachment = new MailAttachment("e:/songlin.mdb", MailEncoding.Base64); myMail.Attachments.Add(myAttachment); SmtpMail.SmtpServer="smtp.163.com"; try { SmtpMail.Send(myMail); } catch { Response.Write("<script language='javascript'> alert('未能发送成功!')</script>"); }大家看这个错在哪?发送不成功啊 我采用了luck0235大哥的做法,现在有2个疑问还想问各位大哥:1、我发送给新浪油箱后进入后“不明邮件”,如何不进入“不明邮件”而是直接进入“未读邮件”2、我发给163.com后发送是成功了,可是怎么收不到呢 HTML的Table放在asp:FormView中后, 其不显示边线 请教前辈 c#下载文件的疑问 谢谢 asp.net 问题,急 大家帮帮忙 在js中如何给ajax控件赋值 如何获取字符串真实长度? 请问“文件名无效”是什么意思? listbox字符串长了显示不下如何解决?如何添加横向滚动条? 服务器端导出Excel文件,出现错误,检索 COM 类工厂中 CLSID 为的组件失败。求大神解决,遇见过这个实际错误的!! 一个烦人的问题!请大家帮忙解决!一定给分! ASP.NET如何实现上下滚动文字,和滚动图片啊! 请教各位,要将下列asp代码转换为.net的用户控件,怎样写法?
可以看一下!.NET自带的不过不怎么好!
我用的是jmail 要下载一个安装文件http://www.mydown.com/code/115/115586.html使用
http://www.blueidea.com/bbs/newsdetail.asp?id=1036923
(in C#)
using System.Web.Mail;
public void sendMail()
{
try
{
System.Web.Mail.MailMessage myMail=new MailMessage();
myMail.From = "[email protected]";
myMail.To = "[email protected]";
myMail.Subject = "MailTest";
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "Test";
SmtpMail.SmtpServer="smarthost"; //your smtp server here SmtpMail.Send(myMail);
}
catch(Exception e)
{
throw e;
}
}
//创建对象
MailMessage myMail = new MailMessage();
//发送服务器
SmtpMail.SmtpServer="smtp.sina.com.cn";
//认证
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate","1");
//用户名
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","luck");
//密码
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword","xxx");
//收信人
myMail.To=txtTo.Text.Trim();//收信人
//寄信人
myMail.From=txtFrom.Text.Trim();
//主题
myMail.Subject=txtTitle.Text.Trim();
//内容
myMail.Body=txtContent.Text;
//正文格式
myMail.BodyFormat=MailFormat.Text;
//优先级
myMail.Priority=MailPriority.High;
//发送
SmtpMail.Send(myMail);
......
myMail.From="[email protected]";
myMail.To="[email protected]";
myMail.Subject="test";
myMail.BodyFormat = MailFormat.Html;
myMail.Body="<html><body>test!test!</body></html>";
MailAttachment myAttachment = new MailAttachment("e:/songlin.mdb", MailEncoding.Base64);
myMail.Attachments.Add(myAttachment);
SmtpMail.SmtpServer="smtp.163.com";
try
{
SmtpMail.Send(myMail);
}
catch
{
Response.Write("<script language='javascript'> alert('未能发送成功!')</script>");
}
大家看这个错在哪?
发送不成功啊
1、我发送给新浪油箱后进入后“不明邮件”,如何不进入“不明邮件”而是直接进入“未读邮件”
2、我发给163.com后发送是成功了,可是怎么收不到呢