public static void StartSendMail(string mailto,string mailFrom,string subject,string mailBody)
{
MailMessage objMessage=new MailMessage();
objMessage.To="[email protected]";
objMessage.From="[email protected]";
objMessage.Subject="aaaaa";
objMessage.BodyFormat=MailFormat.Html;
objMessage.BodyEncoding=Encoding.GetEncoding("GB2312");
objMessage.Body="bbbbb";
SmtpMail.SmtpServer = "stmp.163.com";
SmtpMail.Send(objMessage);
}
发送不出去,是不是因为像有些网友说的需要用户名和密码呢?我觉得也是,不然岂不是所有人都可以以别人邮箱的名义发送了?那么如何添加用户名和密码呢?似乎是objMessage.Fields.Add("网址","用户名/密码");那么请问这里的网址对于163的邮箱到底输入什么呢?谢谢了。
{
MailMessage objMessage=new MailMessage();
objMessage.To="[email protected]";
objMessage.From="[email protected]";
objMessage.Subject="aaaaa";
objMessage.BodyFormat=MailFormat.Html;
objMessage.BodyEncoding=Encoding.GetEncoding("GB2312");
objMessage.Body="bbbbb";
SmtpMail.SmtpServer = "stmp.163.com";
SmtpMail.Send(objMessage);
}
发送不出去,是不是因为像有些网友说的需要用户名和密码呢?我觉得也是,不然岂不是所有人都可以以别人邮箱的名义发送了?那么如何添加用户名和密码呢?似乎是objMessage.Fields.Add("网址","用户名/密码");那么请问这里的网址对于163的邮箱到底输入什么呢?谢谢了。
解决方案 »
- winform 中有inputstream类型吗?
- vs2010Premium版本浏览html文件错误~~~~~~~~~~~~~~~~~~~~~~~~~~
- Response.BinaryWrite 的问题
- Session的问题
- gridview显示问题
- 请教一个关于FreeTextBox使用的问题;<pre>中的代码被无故格式化掉了
- js和ie的支持问题
- webdiyer(陕北吴旗娃) :
- 如何验证文本筐里的输入为日期+时间?在线等。
- 如何配置服务器支持asp.net,必须安装SDK吗?
- 转贴,收集人气——一点小看法:怎样消除业务逻辑对数据持久的依赖的讨论?
- HyplTagName.ForeColor = #562A26; 怎么才能使这个等号成立?
我最近也是碰到这样的问题,我觉得关键是服务器这么培 ,我的邮件有时能发,又时不能发。
但是我对添加用户,和密码不明白,这么作程序肯定好多多人用。输入固定的用户,密码应该不对吧
请二楼讲讲jmail啊,发些资料吧,好多人都推荐用这个
Dim mailMsg As New MailMessage
mailMsg.From = Request("Fa")
mailMsg.To = Request("Email")
mailMsg.Subject = Request("Title")
mailMsg.Priority = MailPriority.High
mailMsg.BodyFormat = MailFormat.Text
mailMsg.Body = Request("Content") & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "www.GoArena.net" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "挑战人生! | 用心的世界!"
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "[email protected]")
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxxxxx")
SmtpMail.SmtpServer = "mail.goarena.net"
SmtpMail.Send(mailMsg)
Response.Redirect("Default.aspx")
End If
Dim smtpServer As String = "smtp.263xxxxx.com"
Dim smtpUser As String = "[email protected]"
Dim smtpPass As String = "xxxxx" Dim oJmailMessage As New jmail.MessageClass
oJmailMessage.Charset = "gb2312"
oJmailMessage.Encoding = "BASE64"
oJmailMessage.ContentType = "text/html"
oJmailMessage.ISOEncodeHeaders = False
oJmailMessage.Priority = Convert.ToByte(1) oJmailMessage.From = "[email protected]"
oJmailMessage.FromName = "xxxxxx"
oJmailMessage.Subject = "新用户注册通知"
oJmailMessage.AddRecipient("[email protected]")
oJmailMessage.MailServerUserName = smtpUser
oJmailMessage.MailServerPassWord = smtpPass
oJmailMessage.Body = "有新用户注册,请查看!"
If oJmailMessage.Send(smtpServer, False) Then
Return True
Else
Return False
End If
oJmailMessage = Nothing
End Function