现在的位置: 首页 > 综合 > 正文

这样的代码能把Email发出去吗!我觉的发出去才怪!

2012年12月10日 ⁄ 综合 ⁄ 共 646字 ⁄ 字号 评论关闭

    
Private Sub btnSend_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles btnSend.Click
        
Dim aMessage As New MailMessage
        aMessage.From 
= Trim(txtEmail.Text)
        aMessage.
To = Trim(txtFEmail.Text)
        aMessage.Subject 
= "您的朋友" & txtName.Text & "给您推荐了一家企业信息(HeNanYellowPage)"
        aMessage.Body = txtDetail.Text
        aMessage.BodyFormat 
= MailFormat.Html
        SmtpMail.SmtpServer 
= ""
        SmtpMail.Send(aMessage)
        Response.
Write("您好,您的推荐信已经发出去了")
    
End Sub

我试了很多次没有发出去。
网上写了很多的类似代码,我觉得发出去才怪。
有的都没有写这行SmtpMail.SmtpServer = ""
记得以前做过类似的Windows的程序,配置OutLook后可以发送,
这次也配置了,不知这么就是不行。

抱歉!评论已关闭.