从ASP.NET 2008发送邮件时出错? [英] Error in Sending Mail from ASP.NET 2008 ?
问题描述
嗨
我正在尝试从aspx页面发送邮件,但它给出了错误
< b>"MailMessage是不明确的,是从名称空间或类型System.Net.Mail导入的"
</b>.我用于发送电子邮件的代码如下.请帮助我
导入System.Net.Mail
昏暗的邮件作为新MailMessage
SmtpMail.SmtpServer ="smtp.mail.yahoo.com"
消息.[收件人] ="dhl_gandhi@yahoo.com"
message.From ="sender@domainName.com"
message.Subject =电子邮件主题"
message.BodyFormat = MailFormat.Html
message.body =测试消息"
SmtpMail.Send(消息)
Response.Write(已发送电子邮件")
谢谢
Hi
I am trying to send mail from aspx page but it gives Error
<b>"MailMessage is ambiguous,imported from the namespaces or types System.Net.Mail"
</b>. A code that I am using for send email is as below.so pls help me
Imports System.Net.Mail
Dim message As New MailMessage
SmtpMail.SmtpServer = "smtp.mail.yahoo.com"
message.[To] = "dhl_gandhi@yahoo.com"
message.From = "sender@domainName.com"
message.Subject = "Email Subject"
message.BodyFormat = MailFormat.Html
message.body = "Test Message"
SmtpMail.Send(message)
Response.Write("Email Sent")
Thanks
推荐答案
您可能已经在范围内的某个地方定义了MailMessage.
尝试:
昏暗的邮件作为新的System.Net.Mail.MailMessage
You''ve probaly got MailMessage defined somewhere in scope.
try :
Dim message As New System.Net.Mail.MailMessage
必须存在两个存在MailMessage的命名空间.请对其进行检查.
看看线程
There must be two namespaces where MailMessage exists.Check it.
Have a look on thread
检查此
Check this article
Regards,
Jamil
这篇关于从ASP.NET 2008发送邮件时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!