2012-08-15 62 views

回答

1

使用此功能VB.Net:

Public Shared Function sendmail(ByVal to As String, ByVal subject As String, ByVal body As String, ByVal IsBodyHtml As Boolean) As Integer 

    Dim mm As New MailMessage("[email protected]", to) 

    mm.Subject = subject 
    mm.Body = body 
    mm.IsBodyHtml = IsBodyHtml 

    Dim smtp As New SmtpClient 
    Try 
     smtp.Send(mm) 
     Return 1 
    Catch ex As Exception 
     Return 0 
    End Try 

End Function 

在你的web.config:

<configuration> 
<system.net> 
<mailSettings> 
    <smtp from="[email protected]"> 
    <network host="smtp.youremailservice.com" 
       userName="[email protected]" 
       password="yourpassword"/> 
    </smtp> 
</mailSettings> 
相關問題